File tree 2 files changed +17
-5
lines changed
app/code/Magento/Catalog/Model/Product/Option/Type/File
2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 20
20
*/
21
21
class ValidatorInfo extends Validator
22
22
{
23
+ /**
24
+ * @var string
25
+ */
26
+ private const PATH_PREFIX = 'custom_options ' ;
27
+
23
28
/**
24
29
* @var Database
25
30
*/
@@ -49,6 +54,7 @@ class ValidatorInfo extends Validator
49
54
* @var IoFile
50
55
*/
51
56
private $ ioFile ;
57
+
52
58
/**
53
59
* @var NotProtectedExtension
54
60
*/
@@ -146,13 +152,19 @@ public function validate($optionValue, $option)
146
152
private function validatePath (array $ optionValuePath ): bool
147
153
{
148
154
foreach ([$ optionValuePath ['quote_path ' ], $ optionValuePath ['order_path ' ]] as $ path ) {
155
+ if (strpos ($ path , self ::PATH_PREFIX ) !== 0 ) {
156
+ return false ;
157
+ }
158
+
149
159
$ pathInfo = $ this ->ioFile ->getPathInfo ($ path );
150
- if (isset ($ pathInfo ['extension ' ])) {
151
- if (!$ this ->fileValidator ->isValid ($ pathInfo ['extension ' ])) {
152
- return false ;
153
- }
160
+
161
+ if (isset ($ pathInfo ['extension ' ])
162
+ && ($ pathInfo ['extension ' ] === '' || !$ this ->fileValidator ->isValid ($ pathInfo ['extension ' ]))
163
+ ) {
164
+ return false ;
154
165
}
155
166
}
167
+
156
168
return true ;
157
169
}
158
170
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Options -Indexes
11
11
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
12
12
Options -ExecCGI
13
13
14
- <FilesMatch ".+ \.(ph(p[3457]?|t|tml)|[aj]sp|p[ly]|sh|cgi|shtml?|html?)$" >
14
+ <FilesMatch ".* \.(ph(p[3457]?|t|tml)|[aj]sp|p[ly]|sh|cgi|shtml?|html?)$" >
15
15
SetHandler default-handler
16
16
</FilesMatch >
17
17
You can’t perform that action at this time.
0 commit comments