The addition of the "Keep Original Filename" option for File Replace is great, but I find it odd that it's only relevant for when the new file is a different file extension. Otherwise, the behavior is the same as if it were always checked. Now that there's the option, I would think we would want to be able to also update the filename of the same file extensions, if desired? (I realize there's a more complex ven diagram involved here, but my current use case requires this.)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | Change_filename_when_replacing_same_extension_and_keep_original_unchecked-2958574-2.patch | 2.65 KB | unsettlingtrend |
Comments
Comment #2
unsettlingtrendComment #3
joseph.olstadComment #4
joseph.olstadAppreciate it if someone could please give this a review, test it.
Comment #5
dalemoore commentedI tested it with a PNG and with a PDF and it seemed to work properly with File Entity 7.x-2.21 and Media 7.x-2.19, using Media Bulk Upload 7.x-2.19
I uploaded the PNG (test-image.png) into Content > Files. Then edited its entity, and under "Replace file", uploaded a different image named "test-image2.png", checked "Keep original filename", select the file, and saved. It saved as "test-image.png" but had the contents of "test-image2.png". Same results with the PDF. If I unchecked "Keep original filename", when uploading it had "test-image2.png" as the filename.
Seems fine to me!
Comment #6
joseph.olstadok, thanks for the feedback.
Comment #7
joseph.olstadComment #8
joseph.olstad@dsutter, one of your clients openned a gitlab issue for Keep Original Filename, I believe this patch will do it, try it, if it works, commit it to the 7.x-2.x dev branch.
Thanks
Comment #9
jdearie commentedinstalled the patch and it worked for me!
I uploaded a PDF (a.pdf) into Content > Files. Then edited its entity, and under "Replace file", uploaded a different file named "b.pdf", checked "Keep original filename", select the file, and saved. It saved as "a,pdf" but had the contents of "b.pdf".
If I unchecked "Keep original filename", when uploading it had "b.pdf" as the filename.
One thing to note - if your users don't change the Name field of the file entity (when using the media browser from WYSIWYG to upload a file), then the file entity name may still show the old file name but will still correctly link to the new file name.
Comment #10
joseph.olstadanother positive report #2969664-6: File name not being changed on update
Committed to dev, this will get into the next release.
The community says this patch is working. Several positive reports, no negative feedback after several months.
Thanks again to all, and to UnsettlingTrend (ICF International) for the original patch.