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.)

Comments

UnsettlingTrend created an issue. See original summary.

unsettlingtrend’s picture

joseph.olstad’s picture

Status: Active » Needs review
joseph.olstad’s picture

Appreciate it if someone could please give this a review, test it.

dalemoore’s picture

I 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!

joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +pending file_entity commit

ok, thanks for the feedback.

joseph.olstad’s picture

joseph.olstad’s picture

Assigned: unsettlingtrend » dsutter

@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

jdearie’s picture

installed 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.

joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

another 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.