File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
Catalog/Model/Product/AttributeSet
ImportExport/Model/Import/Source
lib/internal/Magento/Framework/Archive Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Catalog \Model \Product \AttributeSet ;
7
7
8
+ /**
9
+ * Attribute Set Options
10
+ */
8
11
class Options implements \Magento \Framework \Data \OptionSourceInterface
9
12
{
10
13
/**
11
- * @var null| array
14
+ * @var array
12
15
*/
13
16
protected $ options ;
14
17
@@ -25,15 +28,23 @@ public function __construct(
25
28
}
26
29
27
30
/**
28
- * @return array|null
31
+ * @inheritDoc
29
32
*/
30
33
public function toOptionArray ()
31
34
{
32
35
if (null == $ this ->options ) {
33
36
$ this ->options = $ this ->collectionFactory ->create ()
34
37
->setEntityTypeFilter ($ this ->product ->getTypeId ())
35
38
->toOptionArray ();
39
+
40
+ array_walk (
41
+ $ this ->options ,
42
+ function (&$ option ) {
43
+ $ option ['__disableTmpl ' ] = true ;
44
+ }
45
+ );
36
46
}
47
+
37
48
return $ this ->options ;
38
49
}
39
50
}
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ public function __construct(
32
32
throw new ValidatorException (__ ('Sorry, but the data is invalid or the file is not uploaded. ' ));
33
33
}
34
34
$ 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
+ }
36
42
}
37
43
}
Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ public function unpack($source, $destination)
54
54
$ zip = new \ZipArchive ();
55
55
if ($ zip ->open ($ source ) === true ) {
56
56
$ 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
58
59
$ zip ->extractTo (dirname ($ destination ), $ filename );
59
60
rename (dirname ($ destination ).'/ ' .$ filename , $ destination );
60
61
} else {
You can’t perform that action at this time.
0 commit comments