Skip to content

Commit

Permalink
revert FileUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
klausi committed Apr 21, 2024
1 parent 578d8c9 commit c6311b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/GraphQL/Utility/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Drupal\Core\Render\RenderContext;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Core\StringTranslation\ByteSizeMarkup;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Utility\Token;
use Drupal\file\FileInterface;
Expand Down Expand Up @@ -194,9 +193,13 @@ public function saveFileUpload(UploadedFile $uploaded_file, array $settings): Fi
switch ($uploaded_file->getError()) {
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
// @todo Drupal 10.1 compatibility, needs to be converted to
// ByteSizeMarkup later.
// @phpstan-ignore-next-line
$maxUploadSize = format_size($this->getMaxUploadSize($settings));
$response->addViolation($this->t('The file @file could not be saved because it exceeds @maxsize, the maximum allowed size for uploads.', [
'@file' => $uploaded_file->getClientOriginalName(),
'@maxsize' => ByteSizeMarkup::create($this->getMaxUploadSize($settings)),
'@maxsize' => $maxUploadSize,
]));
return $response;

Expand Down

0 comments on commit c6311b1

Please sign in to comment.