Closed (won't fix)
Project:
File Aliases
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jun 2010 at 00:33 UTC
Updated:
2 Nov 2015 at 23:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
SaxxIng commentedSame problem to me to. And I think this is a bug because the new alias doesn't point correctly to the file (page not found).
Hope to be helpful if someone needs more informations or tests (after a patch).
Saxx
Comment #2
alex.skrypnyksubscribe
Comment #3
danielphenry commentedAlso Seeing this issue.
Comment #4
danielphenry commentedSo I'm new to this patch thing so may not be updating this properly but here is my proposed solution. The behavior is:
1. If you replace the file with one of the same name - the alias will be updated and appear the same from the outside.
2. If you upload a differently named file and no alias exists with that name a new alias will be created and the other deleted.
3. If you upload a differently named file and an alias already exists by that name (from a node or another file having already taken it) the alias will be appended with a number as was the original behavior.
This is based on the release version 1.1
Comment #5
tommyk commentedI could not apply the patch because you need to create it relative(?) to the module directory. (I don't use a "contrib" directory on this site.) I believe the first line in the patch needs to say
diff --git a/file_aliases.module b/file_aliases.module, etc.I'm eager to try it out, though!
Comment #6
tommyk commentedComment #7
tommyk commentedI recreated the patch with Git against the master branch of 6.x.
I've tested scenario 1 from the list in comment #4 and it works as expected.
Comment #8
tommyk commentedRemoving a file and saving the node also successfully deletes the alias for the removed file.
Comment #9
nodiac commentedThe patch applies! It was awesome! This is at an LA Drupal meetup and we just learned how to apply patches.
Comment #10
tommyk commentedWhen using the patch I've noticed my logs filling up with:
Offending section:
I don't understand enough to debug this, but maybe someone can help.
Comment #11
danielphenry commentedJust add
It will get rid of the notice. I had made the bad assumption that the files were always set.
Comment #12
danielphenry commentedHere is a patch file with a couple of checks in it to prevent warnings in the above mentioned code (comment #10)
Comment #13
tommyk commentedThe last attached patch is the same file as the patch posted in comment #7. I'm not sure how that happened.
Comment #14
tommyk commentedThe attached patch is updated with the advice from #11.
Still not sure what happened with the patch from #12.
Comment #15
tommyk commentedComment #16
tommyk commentedAfter some testing today, I have found that the patch in #14 breaks the "Display alias" functionality, where the file alias will be displayed instead of the file when the box is checked.
I don't know what part of the code affects that functionality, so I probably won't be much help on this issue at this point.
Comment #17
koshi commentedVersion 7.x-1.x-dev is also affected by this bug. I think this module should have something like "Check integrity" button on the configuration page. It should find and remove broken (lost) aliases. You can obtain lost aliases if you delete nodes when this module is temporarily disabled. So we need a tool to fix everything when the module become enabled again.
Comment #18
neRok commentedI have made a patch to fix a bunch of issues with File Aliases module, including this issue, in the following issue.
#1896326: Combined patch for all known issues in D7 branch
Sorry- actually for D7, didnt notice.
Comment #19
webservant316 commentedI installed the patch at #14 and I get the same error in #16 that 'display alias' stops working. However, worse the URL alias doesn't get removed if I use the delete file button or delete node button. So when attaching a file by the same name the URL alias module adds '_0' thinking the file is still there. The file is actually deleted but the alias remains. Lastly since the alias is still there but the file is not I get a WSOD when trying to access the alias path after the file is delete.
Others say above that this is working. Wonder what I am doing wrong?
Comment #20
webservant316 commentedafter studying the patch in #14 I am confused about two things....
1. How does this patch help to delete the unused aliases? It appears to try to reuse aliases, but the correct action in the case of deleting a node or deleting a node attachment is to delete the file and also delete the file alias. Where is the file alias getting deleted in those two cases? If the alias is deleted then then the url alias module will not add '_0' thinking that a file by the alias already exists.
2. Line 116 in the #14 patch adds a 'break;'. Seems like if this patch is properly applied that the following 22 lines in the case statement will never get executed. That cannot be right. Are these the lines responsible for displaying the aliases path to the file on the node?
Seems like the patch needs to add cases to 'delete' and 'update' in function 'file_aliases_nodeapi()'. In the case of 'delete' we need to 'delete' all the file aliases associated with the node. In the case of 'update' keep it simple and just delete and recreate all the file aliases associated with the node.
Comment #21
webservant316 commentedThis module could be very useful, but the problem in this issue is a show stopper for me. I will keep watching this queue to see if fixes are made. Since my need was simply to provide an alias in one very specific case I was able to create an .htaccess rewrite rule in 5 minutes versus debugging this module.
Here is the line of code I added to my Drupal .htaccess file....
RewriteRule ^(.*)/CCR$ /sites/default/files/userupload/homepage/$1/CCR.pdf [L,R=302]
The $1 is the 'username' that created a single 'homepage' node with a single file field attachment defined to put the attachment in the location above.
Comment #22
deciphered commentedThe Drupal 6 version of this module will not be receiving any more support.