File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed
dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Save Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -295,19 +295,20 @@ public function readDirectory($path): array
295295 */
296296 public function getRealPathSafety ($ path )
297297 {
298+ //Removing redundant directory separators
299+ $ path = preg_replace (
300+ '~(?<!:)\/\/+~ ' ,
301+ '/ ' ,
302+ $ path
303+ );
304+
298305 if (strpos ($ path , '/. ' ) === false ) {
299306 return $ path ;
300307 }
301308
302309 $ isAbsolute = strpos ($ path , $ this ->normalizeAbsolutePath ('' )) === 0 ;
303310 $ path = $ this ->normalizeRelativePath ($ path );
304311
305- //Removing redundant directory separators.
306- $ path = preg_replace (
307- '/ \\/ \\/+/ ' ,
308- '/ ' ,
309- $ path
310- );
311312 $ pathParts = explode ('/ ' , $ path );
312313 if (end ($ pathParts ) === '. ' ) {
313314 $ pathParts [count ($ pathParts ) - 1 ] = '' ;
Original file line number Diff line number Diff line change @@ -407,6 +407,18 @@ public function getRealPathSafetyDataProvider(): array
407407 [
408408 'test/test/../test.txt ' ,
409409 'test/test.txt '
410+ ],
411+ [
412+ 'test//test/../test.txt ' ,
413+ 'test/test.txt '
414+ ],
415+ [
416+ 'test1///test2/..//test3//test.txt ' ,
417+ 'test1/test3/test.txt '
418+ ],
419+ [
420+ self ::URL . '/test1///test2/..//test3//test.txt ' ,
421+ self ::URL . 'test1/test3/test.txt '
410422 ]
411423 ];
412424 }
Original file line number Diff line number Diff line change @@ -138,8 +138,10 @@ private function assertSuccessfulImageSave(array $expectation): void
138138 $ this ->assertEquals ($ expectation ['small_image ' ], $ product ->getData ('small_image ' ));
139139 $ this ->assertEquals ($ expectation ['thumbnail ' ], $ product ->getData ('thumbnail ' ));
140140 $ this ->assertEquals ($ expectation ['swatch_image ' ], $ product ->getData ('swatch_image ' ));
141- $ this ->assertFileExists (
142- $ this ->mediaDirectory ->getAbsolutePath ($ this ->config ->getBaseMediaPath () . $ expectation ['image ' ])
141+ $ this ->assertTrue (
142+ $ this ->mediaDirectory ->isExist (
143+ $ this ->mediaDirectory ->getAbsolutePath ($ this ->config ->getBaseMediaPath () . $ expectation ['image ' ])
144+ )
143145 );
144146 }
145147}
You can’t perform that action at this time.
0 commit comments