Posted by jdwfly on January 7, 2010 at 12:56am
Jump to:
| Project: | File Aliases |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
user warning: Duplicate entry 'downloads/apache-folder-junk.txt-' for key 2 query: INSERT INTO url_alias (src, dst, language) VALUES ('filefield_paths/alias/250', 'downloads/apache-folder-junk.txt', '') in /my/webiste/modules/path/path.module on line 112
When I upload a duplicate file I get the above error. Looks like it doesn't check to see if there is already an alias before it tries to create one.
Comments
#1
Hi,
I have been able to reproduce this issue and the problem appears to be that the pattern being used to create the file alias is not unique enough to prevent duplicates. Clearly there needs to be validation module side to prevent this, which I will look into, most likely the solution will be similar to that of Drupals behavior suffixing the filename with _# (file.jpg, file_0.jpg, file_1.jpg, etc).
A work around, and generally a good idea, would be to adjust your pattern to prevent duplicates, whether that means using the [nid], [filefield-fid] or other unique identifier is entirely up to you.
Will get a fix in ASAP.
Cheers,
Deciphered.
#2
Fix committed to DRUPAL-6--1.
Cheers,
Deciphered.
#3
Thanks, I can confirm this is fixed.
#4
Excellent.