diff --git a/Library/Homebrew/test/unpack_strategy/dmg_spec.rb b/Library/Homebrew/test/unpack_strategy/dmg_spec.rb index edb23a6f80..7dd3a39165 100644 --- a/Library/Homebrew/test/unpack_strategy/dmg_spec.rb +++ b/Library/Homebrew/test/unpack_strategy/dmg_spec.rb @@ -4,6 +4,24 @@ require_relative "shared_examples" RSpec.describe UnpackStrategy::Dmg, :needs_macos do + describe UnpackStrategy::Dmg::Bom do + it "ignores Desktop DB at the volume root" do + expect(described_class.dmg_metadata?(Pathname("./Desktop DB"))).to be true + end + + it "ignores Desktop DF at the volume root" do + expect(described_class.dmg_metadata?(Pathname("./Desktop DF"))).to be true + end + + it "preserves Desktop DB inside an application" do + expect(described_class.dmg_metadata?(Pathname("Example.app/Contents/Resources/Desktop DB"))).to be false + end + + it "preserves Desktop DF inside an application" do + expect(described_class.dmg_metadata?(Pathname("Example.app/Contents/Resources/Desktop DF"))).to be false + end + end + describe "#mount" do subject(:path) { TEST_FIXTURE_DIR/"cask/container.dmg" } diff --git a/Library/Homebrew/unpack_strategy/dmg.rb b/Library/Homebrew/unpack_strategy/dmg.rb index 1ed4ae374f..8c0759a93d 100644 --- a/Library/Homebrew/unpack_strategy/dmg.rb +++ b/Library/Homebrew/unpack_strategy/dmg.rb @@ -31,6 +31,8 @@ module UnpackStrategy ".VolumeIcon.icns", ".HFS+ Private Directory Data\r", # do not remove `\r`, it is a part of directory name ".HFS+ Private Data\r", + "Desktop DB", + "Desktop DF", ]).freeze, T::Set[String]) private_constant :DMG_METADATA