Skip to content

Commit a4d57b9

Browse files
committed
Resolve issue 25896: Cannot create folder using only letters
1 parent 36ea828 commit a4d57b9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-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
}

0 commit comments

Comments
 (0)