diff --git a/core/lib/Drupal/Core/File/FileSystem.php b/core/lib/Drupal/Core/File/FileSystem.php index ab21b365cb..e7e4c7a194 100644 --- a/core/lib/Drupal/Core/File/FileSystem.php +++ b/core/lib/Drupal/Core/File/FileSystem.php @@ -466,10 +466,11 @@ protected function prepareDestination($source, &$destination, $replace) { // Perhaps $destination is a dir/file? $dirname = $this->dirname($destination); if (!$this->prepareDirectory($dirname)) { - $this->logger->error("The specified file '%original_source' could not be copied because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions.", [ + $this->logger->error("The specified file '%original_source' could not be copied because the destination directory '%destination_directory' is not properly configured. This may be caused by a problem with file or directory permissions.", [ '%original_source' => $original_source, + '%destination_directory' => $dirname, ]); - throw new DirectoryNotReadyException("The specified file '$original_source' could not be copied because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions."); + throw new DirectoryNotReadyException("The specified file '$original_source' could not be copied because the destination directory '$dirname' is not properly configured. This may be caused by a problem with file or directory permissions."); } } diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php index 153f992d77..5122fd485e 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileSystemTest.php @@ -52,7 +52,7 @@ public function testEnsureFileExistsBeforeCopy() { */ public function testDestinationDirectoryFailureOnCopy() { $this->expectException(DirectoryNotReadyException::class); - $this->expectExceptionMessage("The specified file 'public://test.txt' could not be copied because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions"); + $this->expectExceptionMessage("The specified file 'public://test.txt' could not be copied because the destination directory public://subdirectory is not properly configured. This may be caused by a problem with file or directory permissions."); touch('public://test.txt'); // public://subdirectory has not been created, so \Drupal::service('file_system')->prepareDirectory() // will fail, causing copy() to throw DirectoryNotReadyException.