on line 1077 of the file .module it has this
\Drupal::messenger()->addError(t('The file %source could not be uploaded because a file by that name already exists in the destination %directory.', ['%source' => $form_field_name, '%directory' => $destination]));
it should be this :
\Drupal::messenger()->addError(t('The file %source could not be uploaded because a file by that name already exists in the destination %directory.', ['%source' => $file->getFilename(), '%directory' => $destination]));
if not it does not identify the name of the file correctly
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3112004-10.patch | 1.97 KB | kim.pepper |
Issue fork drupal-3112004
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dianacastillo commentedComment #4
lendudeMight be more of a task than a bug, but let's treat it like a bug.
Changed the message as suggested in the IS and added test coverage for the error, which was missing. Also updated the comment so it no longer points to a constant that no longer exists.
Adding a test-only patch, but its a bit iffy since I wouldn't expect that to pass since we are changing the output.
Before the error would read something like :
The file <em class="placeholder">file_test_upload</em> could not be uploaded because a file by that name already exists in the destination <em class="placeholder">temporary://</em>.After it will show:
The file <em class="placeholder">image-test.png</em> could not be uploaded because a file by that name already exists in the destination <em class="placeholder">temporary://</em>.Comment #5
lendudeNow without the unrelated test getting added......
Comment #6
kim.pepperThis may or may not get in before #3232248: Move _file_save_upload_single to a service and deprecate which is a major rework. Linking it here.
Comment #8
joachim commentedPatch looks good to me.
Comment #10
kim.pepperRe-roll of #5 for 10.0.x
Comment #15
mohit_aghera commentedThis issue doesn't exist anymore.
File upload handler has updated the message and the current updated message contains actual filename.
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/file/...
I think we should close this.
Please reopen if you feel it is still valid.