diff --git a/src/Composer/Util/Zip.php b/src/Composer/Util/Zip.php index 82cd34b71..3cb634eab 100644 --- a/src/Composer/Util/Zip.php +++ b/src/Composer/Util/Zip.php @@ -82,6 +82,11 @@ class Zip $name = $zip->getNameIndex($i); $dirname = dirname($name); + // ignore OSX specific resource fork folder + if (strpos($name, '__MACOSX') !== false) { + continue; + } + // handle archives with proper TOC if ($dirname === '.') { $topLevelPaths[$name] = true; diff --git a/tests/Composer/Test/Util/Fixtures/Zip/multiple_subfolders.zip b/tests/Composer/Test/Util/Fixtures/Zip/multiple_subfolders.zip deleted file mode 100644 index 5c5bc5adf..000000000 Binary files a/tests/Composer/Test/Util/Fixtures/Zip/multiple_subfolders.zip and /dev/null differ diff --git a/tests/Composer/Test/Util/ZipTest.php b/tests/Composer/Test/Util/ZipTest.php index 282c9b27c..2b0129bc8 100644 --- a/tests/Composer/Test/Util/ZipTest.php +++ b/tests/Composer/Test/Util/ZipTest.php @@ -125,16 +125,4 @@ class ZipTest extends TestCase $this->assertEquals("{\n \"name\": \"foo/bar\"\n}\n", $result); } - - public function testThrowsExceptionIfMultipleComposerInSubFoldersWereFound() - { - if (!extension_loaded('zip')) { - $this->markTestSkipped('The PHP zip extension is not loaded.'); - return; - } - - $this->setExpectedException('\RuntimeException', 'Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: foo3/,__MACOSX/'); - - Zip::getComposerJson(__DIR__.'/Fixtures/Zip/multiple_subfolders.zip'); - } }