Skip to content

Commit 58d546a

Browse files
SarmisthaSarmistha
authored andcommitted
Merge remote-tracking branch 'adobe-commerce-tier-4/ACP2E-2959' into Tier4-Kings-PR-06-03-2024
2 parents 1c314c0 + 676c4d2 commit 58d546a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

lib/internal/Magento/Framework/Filesystem/Directory/PathValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function validate(
5454
$actualPath = $this->driver->getRealPathSafety($path);
5555
}
5656

57-
if (preg_match('/(?:^-|\s-)/', $path)
57+
if (preg_match('/(?:^-|\s-\S|[\t\r\n\f])/', $path)
5858
|| (
5959
mb_strpos($actualPath, $realDirectoryPath) !== 0
6060
&& rtrim($path, DIRECTORY_SEPARATOR) !== $realDirectoryPath

lib/internal/Magento/Framework/Filesystem/Test/Unit/Directory/PathValidatorTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<?php declare(strict_types=1);
2-
/**
3-
* Unit Test for \Magento\Framework\Filesystem\Directory\PathValidator
2+
/************************************************************************
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
45
*
5-
* Copyright © Magento, Inc. All rights reserved.
6-
* See COPYING.txt for license details.
6+
* NOTICE: All information contained herein is, and remains
7+
* the property of Adobe and its suppliers, if any. The intellectual
8+
* and technical concepts contained herein are proprietary to Adobe
9+
* and its suppliers and are protected by all applicable intellectual
10+
* property laws, including trade secret and copyright laws.
11+
* Dissemination of this information or reproduction of this material
12+
* is strictly forbidden unless prior written permission is obtained
13+
* from Adobe.
14+
* ***********************************************************************
715
*/
816
namespace Magento\Framework\Filesystem\Test\Unit\Directory;
917

@@ -77,6 +85,7 @@ public function validateDataProvider()
7785
return [
7886
['/directory/path/', '/directory/path/', '/', false, '/://'],
7987
['/directory/path/', '/var/.regenerate', null, false, ''],
88+
['/directory/path/', '/var/image - 1.jpg', null, false, ''],
8089
];
8190
}
8291
}

0 commit comments

Comments
 (0)