Skip to content

Commit

Permalink
Resolve issue 25896: Cannot create folder using only letters
Browse files Browse the repository at this point in the history
  • Loading branch information
edenduong committed Dec 4, 2019
1 parent 36ea828 commit a4d57b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public function createDirectory($name, $path)
{
if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) {
throw new \Magento\Framework\Exception\LocalizedException(
__('Please rename the folder using only letters, numbers, underscores and dashes.')
__('Please rename the folder using only Latin letters, numbers, underscores and dashes.')
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Magento\Cms\Model\Wysiwyg\Images\Storage\Collection as StorageCollection;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Exception\LocalizedException;

/**
* @SuppressWarnings(PHPMD.LongVariable)
Expand Down Expand Up @@ -539,4 +540,18 @@ public function testUploadFile()

$this->assertEquals($result, $this->imagesStorage->uploadFile($targetPath, $type));
}

/**
* Test create directory with invalid name
*/
public function testCreateDirectoryWithInvalidName()
{
$name = 'папка';
$path = '/tmp/path';
$this->expectException(LocalizedException::class);
$this->expectExceptionMessage(
(string)__('Please rename the folder using only Latin letters, numbers, underscores and dashes.')
);
$this->imagesStorage->createDirectory($name, $path);
}
}

0 comments on commit a4d57b9

Please sign in to comment.