Skip to content

Commit 593a9e2

Browse files
ENGCOM-6443: Resolve issue 25896: Cannot create folder using only letters #25904
2 parents c2c236e + 2cff2a8 commit 593a9e2

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public function createDirectory($name, $path)
416416
{
417417
if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) {
418418
throw new \Magento\Framework\Exception\LocalizedException(
419-
__('Please rename the folder using only letters, numbers, underscores and dashes.')
419+
__('Please rename the folder using only Latin letters, numbers, underscores and dashes.')
420420
);
421421
}
422422

app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Cms\Model\Wysiwyg\Images\Storage\Collection as StorageCollection;
99
use Magento\Framework\App\Filesystem\DirectoryList;
10+
use Magento\Framework\Exception\LocalizedException;
1011

1112
/**
1213
* @SuppressWarnings(PHPMD.LongVariable)
@@ -539,4 +540,18 @@ public function testUploadFile()
539540

540541
$this->assertEquals($result, $this->imagesStorage->uploadFile($targetPath, $type));
541542
}
543+
544+
/**
545+
* Test create directory with invalid name
546+
*/
547+
public function testCreateDirectoryWithInvalidName()
548+
{
549+
$name = 'папка';
550+
$path = '/tmp/path';
551+
$this->expectException(LocalizedException::class);
552+
$this->expectExceptionMessage(
553+
(string)__('Please rename the folder using only Latin letters, numbers, underscores and dashes.')
554+
);
555+
$this->imagesStorage->createDirectory($name, $path);
556+
}
542557
}

app/code/Magento/Cms/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Pages,Pages
7676
"The page URL key contains capital letters or disallowed symbols.","The page URL key contains capital letters or disallowed symbols."
7777
"The page URL key cannot be made of only numbers.","The page URL key cannot be made of only numbers."
7878
"Please rename the folder using only letters, numbers, underscores and dashes.","Please rename the folder using only letters, numbers, underscores and dashes."
79+
"Please rename the folder using only Latin letters, numbers, underscores and dashes.","Please rename the folder using only Latin letters, numbers, underscores and dashes."
7980
"We found a directory with the same name. Please try another folder name.","We found a directory with the same name. Please try another folder name."
8081
"We cannot create a new directory.","We cannot create a new directory."
8182
"We cannot delete directory %1.","We cannot delete directory %1."

0 commit comments

Comments
 (0)