diff --git a/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php b/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php index 0b7214c7b3..ea8cbbb360 100644 --- a/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php +++ b/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php @@ -174,6 +174,9 @@ public function post(Request $request, $entity_type_id, $bundle, $field_name) { $temp_file_path = $this->streamUploadData($file_uri); + // This will take care of altering $file_uri if a file already exists. + file_unmanaged_prepare($temp_file_path, $file_uri); + // Begin building file entity. $values = [ 'uid' => $this->currentUser->id(),