Needs work
Project:
Link
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 May 2012 at 20:36 UTC
Updated:
22 Mar 2018 at 16:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
arpieb commentedHere's the small patch to those regexes...
Comment #2
arpieb commentedUpdated patch with open/close parentheses added to regex string for files
Comment #3
jcfiala commentedWell, I thought %20 was the thing to do, but it turns out I was wrong in testing.
So - merged, and will be live in 7.x-1.1.
Comment #4
arpieb commentedYeah, if the file is saved with a space in it, the %20 won't match it. We specifically ran into it with a data migration, but if I'm not mistaken file uploads will also preserve the space.
Thanks for merging in so quickly!
Comment #5
arpieb commentedOK, guess who's back with yet another regex change... Did some research after discovering filenames with & and * in them, and discovered Un*x filenames can contain anything except NUL (\0). That being said, Windows and OS X have their own restrictions, but creating files on those OS's is going to limit those filenames to a subset of what Un*x can handle.
In that case, we should probably check for any filename that is possible on a Un*x system as well as for the existence of said file. The attached patch does just that, and actually accepts a file with the following internal path (which I was actually able to create from the command line on a Linux system):
... and the Link module was able to generate a valid URL to download the file. Sorry for the follow-on, but I was not aware of just how much you could get away with in a Un*x filename!
Comment #6
damienmckennaI suggest adding some tests for this to confirm it works as intended.