Skip to content

Commit d249204

Browse files
committed
Merge remote-tracking branch 'remotes/origin/MC-17582' into owls-2.2.10-delivery
2 parents a2c7a9b + f204c7e commit d249204

File tree

2 files changed

+9
-2
lines changed
  • app/code/Magento/ImportExport/Model/Import/Source
  • lib/internal/Magento/Framework/Archive

2 files changed

+9
-2
lines changed

app/code/Magento/ImportExport/Model/Import/Source/Zip.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ public function __construct(
3232
throw new ValidatorException(__('Sorry, but the data is invalid or the file is not uploaded.'));
3333
}
3434
$directory->delete($directory->getRelativePath($file));
35-
parent::__construct($csvFile, $directory, $options);
35+
36+
try {
37+
parent::__construct($csvFile, $directory, $options);
38+
} catch (\LogicException $e) {
39+
$directory->delete($directory->getRelativePath($csvFile));
40+
throw $e;
41+
}
3642
}
3743
}

lib/internal/Magento/Framework/Archive/Zip.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function unpack($source, $destination)
5454
$zip = new \ZipArchive();
5555
if ($zip->open($source) === true) {
5656
$filename = $this->filterRelativePaths($zip->getNameIndex(0) ?: '');
57-
if ($filename) {
57+
if ($filename && !preg_match('#[:"*?|<>%]#', $filename)) {
58+
// extract first entry in zip file to destination directory
5859
$zip->extractTo(dirname($destination), $filename);
5960
rename(dirname($destination).'/'.$filename, $destination);
6061
} else {

0 commit comments

Comments
 (0)