Skip to content

Commit

Permalink
Fix 7zip issues on windows when mixing forward and backslashes, fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 18, 2021
1 parent b7bb771 commit 5c20168
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Composer/Downloader/ZipDownloader.php
Expand Up @@ -115,6 +115,12 @@ private function extractWithSystemUnzip(PackageInterface $package, $file, $path)

$commandSpec = reset(self::$unzipCommands);
$command = sprintf($commandSpec[1], ProcessExecutor::escape($file), ProcessExecutor::escape($path));
// normalize separators to backslashes to avoid problems with 7-zip on windows
// see https://github.com/composer/composer/issues/10058
if (Platform::isWindows()) {
$command = sprintf($commandSpec[1], ProcessExecutor::escape(strtr($file, '/', '\\')), ProcessExecutor::escape(strtr($path, '/', '\\')));
}

$executable = $commandSpec[0];

$self = $this;
Expand Down

0 comments on commit 5c20168

Please sign in to comment.