Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve issue 25896: Cannot create folder using only letters #25904

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.')
dmytro-ch marked this conversation as resolved.
Show resolved Hide resolved
);
}

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);
}
}