This is a duplicate of https://www.drupal.org/node/2045611 since that issue is closed and can't be reopened.
Steps to reproduce:
- Navigate to the files listing from admin menu
- Select Edit for the file that needs replacement
- Use the
Replace Filefield, and and select the new file - Save the old file
On the files listing, the file you hoped to replace APPEARS TO remains unchanged -- same file path, same file ID, same usage, still marked as permanent.
However, on the files listing there is now ALSO a new entry for a new file -- with a new file path, new file, ID, no usage at all (and the new file is marked as temporary). This new entry has the filename and file path of the file you just added.
This is confusing to users because it appears as though the change you just made did nothing, and instead a new record was created with the information you wanted in the old record. In reality, the old record was, in fact, updated, but the addition of the new temporary record makes it seem as though something has gone wrong.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | file_entity-delete_same_ext_temporary_on_successful_replace-2887487-D7.patch | 919 bytes | fskreuz |
Comments
Comment #2
jenlamptonComment #3
jenlamptonComment #4
jenlamptonHm, I misunderstood what was happening with the file replacement because the experience of seeing the new temporary record threw me off. Updating ticket label, description, and severity to match the user experience issue.
Comment #5
joseph.olstadYes it is a configuration dilema for existing installs, if my grey matter memory about this is still valid the file paths pattern is only different behavior for new fresh installs.
I didn't want to impose a config change on existing installs in case that config was relied upon or expected by the site builder.
We can maybe see here about proposing some new g.u.i option that would give option on this however it has been over 2 weeks since I looked at this so I'd have to look closer at this and in no hurry about it.
Comment #6
alisonI think also that these temp files go away, IIRC... did that happen in your usage, Jen, now that it's been a few days?
Comment #7
kmontyExperiencing similar issues. Oddly wasn't experiencing the problem with -beta3, but rolling back the codebase didn't resolve the issue.
Comment #8
joseph.olstada few commits have been put int dev, might be worth re-testing.
Comment #9
drupal-son commentedHi,
Same issue here.
I updated to the latest version 7.x-2.3 (released yesterday) where all those new commits should be merged.
No difference.
When replacing the file, the old one gets replaced but a new entry is created with the /system/temporary/filename.ext path.
I can notice that the file ID are not the same, the new file gets incremented.
If I upload the same file as a new file, then a /filename_0.ext is created as a new file entity.
I remember I applied an old patch which renamed the existing file with the N+1 and keeps the original name for the new uploaded file. Is this the expected behavior when uploading duplicated files?
Thanks.
Comment #10
drupal-son commentedRunning cron doesn't remove the temporary marked file entities.
In the meantime, as a workaround, this is what I did:
I created a new version of the /admin/content/file view where I'm showing a few more fields, exposing some filters and filtering out the status marked as temporary entities.
This way, I'm showing to my users only the permanent files avoiding confusion to them and at the same time giving them a few more tools to manage the files on the website.
It seems that the Media Browser (the LIBRARY tab) is also filtering out the files marked as temporary, so that is consistent of what I'm showing to my users on the new /admin/content/file view.
Regarding the other question about the new (but duplicated) file name behavior, I would like the new file to be handled as a replacement file of that file name.
Thanks.
Comment #11
estepix commentedDid anyone have a look at the patch I submitted here?
https://www.drupal.org/node/2045611#comment-12112131
I'm currently using it in a site and it seems to work well, not sure if this is the way to go though, after reading comment #5
Comment #12
loziju commented@estepix the patch in https://www.drupal.org/node/2045611#comment-12112131 does not work for me. That piece of code is already inside 7.x-2.2 and 7.x-2.3.
I confirm that the issue still happens on 7.x-2.3. Updating the issue metadata to that version.
I also have media 7.x-2.9 installed, although I don't think the issue comes from media.
Comment #13
lindakosta commentedWe're on 7.23 and we're having the same issue. When we first upload a replacement file, it replaces the file, but the file name renames the same even though the replacement file has a different name. The temporary file is created and eventually goes away, and the permanent file eventually is renamed using the replacement file name.
We also have the media module (7.2.3) installed. We also installed media 7.x-3.0-beta4 and continued to experience the same issue.
Comment #14
fskreuz commentedPatch ensures that after successful replacement, the temporary file is deleted.
Comment #15
stephaneqHi,
Tested your patch, it seems to fix the issue for me. Thanks.
Comment #16
joseph.olstadPatch looks good thanks!
Comment #18
joseph.olstadNice job @fskreuz!
Munga tuk
Comment #19
joseph.olstadcommitted to 7.x-2.x dev
Haven't decided yet when to tag the next release though, might be worth a tag for just this fix. Thanks.
Comment #21
estepix commentedI just tried version 2.4 and it's working alright! thanks everyone!
Comment #22
joseph.olstadSuccess! Thanks for reporting.