Issue #3264153 by neclimdul: Fix missing sprintf argument in CKEditor5ImageController

merge-requests/1814/head
catch 2022-02-14 14:29:14 +00:00
parent f9c1d8a85a
commit 5ac3d364d8
3 changed files with 13 additions and 6 deletions

View File

@ -164,7 +164,7 @@ class CKEditor5ImageController extends ControllerBase {
$lock_id = $this->generateLockIdFromFileUri($file_uri);
if (!$this->lock->acquire($lock_id)) {
throw new HttpException(503, sprintf('File "%s" is already locked for writing.'), NULL, ['Retry-After' => 1]);
throw new HttpException(503, sprintf('File "%s" is already locked for writing.', $file_uri), NULL, ['Retry-After' => 1]);
}
// Begin building file entity.

View File

@ -2,6 +2,9 @@
namespace Drupal\Tests\ckeditor5\Functional;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\File\FileSystemInterface;
/**
* Test image upload access.
*
@ -42,6 +45,15 @@ class ImageUploadAccessTest extends ImageUploadTest {
$response = $this->uploadRequest($url, $test_image, 'test.jpg');
$this->assertSame(201, $response->getStatusCode());
// Ensure lock failures are reported correctly.
$d = 'public://inline-images/test.jpg';
$f = $this->container->get('file_system')->getDestinationFilename($d, FileSystemInterface::EXISTS_RENAME);
$this->container->get('lock')
->acquire('file:ckeditor5:' . Crypt::hashBase64($f));
$response = $this->uploadRequest($url, $test_image, 'test.jpg');
$this->assertSame(503, $response->getStatusCode());
$this->assertStringContainsString('File "public://inline-images/test_0.jpg" is already locked for writing.', (string) $response->getBody());
// Ensure that users without permissions to the text format cannot upload
// images.
$this->drupalLogout();

View File

@ -280,11 +280,6 @@ parameters:
count: 2
path: modules/ckeditor5/ckeditor5.module
-
message: "#^Call to sprintf contains 1 placeholder, 0 values given\\.$#"
count: 1
path: modules/ckeditor5/src/Controller/CKEditor5ImageController.php
-
message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:10\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
count: 1