Patch (to be ported)
Project:
Private Upload
Version:
5.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jul 2008 at 13:02 UTC
Updated:
29 Nov 2009 at 17:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
acrollet commentedI'm attaching a patch to fix this issue - it uses the default drupal behavior of appending an incremented digit to duplicate filenames. It would be easy to make a preference for this behavior, but my contention is that this patch produces the the correct behavior, as it avoids database inconsistency. (producing messages like this: There are '29' files in the private folder, and the DB thinks there are '116' private files.)
Comment #2
acrollet commentedI'm attaching a patch to fix this issue - it uses the default drupal behavior of appending an incremented digit to duplicate filenames. It would be easy to make a preference for this behavior, but my contention is that this patch produces the the correct behavior, as it avoids database inconsistency. (producing messages like this: There are '29' files in the private folder, and the DB thinks there are '116' private files.)
Comment #3
jody lynnSee also #371492: Upload a file with the same name doesn't remove the old upload. Same bug exists in D6. It can cause loss of files, incorrect file served, and corrupt (truncated by wrong filesize) files served.
Comment #4
Anonymous (not verified) commentedattached is a patch for the 6 branch.
Comment #5
jody lynnReviewed and tested Justin's patch.
As well as patching the module you may need to do some manual cleanup of your files if they were affected by this. A few of the things I did to generate lists of files needing cleanup:
The bug could result in having missing files or files that were overwritten with a different file. This will print out files that do not match their filesize in the database, either because they are missing or because they were overwritten with a different file:
Sql query to list filepaths that are in the files and upload table more than once.
Comment #6
jody lynnFixed in the D6 dev branch. Still an issue for D5. The patch in comment 1 needs review and testing or the patch in #4 needs porting.