summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/file/file.module
diff options
context:
space:
mode:
authorAlex Pott <alex.a.pott@googlemail.com>2024-03-02 11:58:23 +0000
committerAlex Pott <alex.a.pott@googlemail.com>2024-03-02 11:58:23 +0000
commit6236d36180cf7ae446b6d4847861998a649bf830 (patch)
tree8200a7ba8941f72e7856f129f795c37a2da3b5cd /core/modules/file/file.module
parent94b03bcdec88d86a963824fabd0f686f2bd2a5ac (diff)
downloaddrupal-6236d36180cf7ae446b6d4847861998a649bf830.tar.gz
drupal-6236d36180cf7ae446b6d4847861998a649bf830.zip
Issue #3389016 by kim.pepper, xjm, larowlan: Add file upload lock handling to FileUploadHandler
Diffstat (limited to 'core/modules/file/file.module')
-rw-r--r--core/modules/file/file.module5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 4f251e03471..b97f178a8a4 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -17,6 +17,7 @@ use Drupal\Core\File\Exception\InvalidStreamWrapperException;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
+use Drupal\Core\Lock\LockAcquiringException;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\Element;
@@ -712,6 +713,10 @@ function file_save_upload($form_field_name, $validators = [], $destination = FAL
\Drupal::messenger()->addError(t('The file %filename could not be uploaded because the name is invalid.', ['%filename' => $uploaded_file->getClientOriginalName()]));
$files[$i] = FALSE;
}
+ catch (LockAcquiringException $e) {
+ \Drupal::messenger()->addError(t('File already locked for writing.'));
+ $files[$i] = FALSE;
+ }
}
// Add files to the cache.