In #2158107: files: link inserted does not point to download but to entity page ("/file/FID" instead of "/system/files/FILEPATH"), we added the ability to have Linkit insert direct links to files.
However, between my original patch and when it was committed, a change was made to try and use relative links that broke links to private files (and temporary files too but who links to those?)
If your 'file_private_path' is '../private' (ie. a directory above the webroot), for example, it'll generate links like:
/../private/filename.txt
... which are inaccessible, because the private path is outside the webroot. The correct path would be:
/system/files/filename.txt
Or, even if 'file_private_path' is inside the webroot, like 'sites/default/private', a properly configured webserver would deny direct access to that directory so that file access has to pass through Drupal.
I'll attach a patch in a little bit to fix!
Comment | File | Size | Author |
---|---|---|---|
#2 | linkit-private-files-2922306-2.patch | 1.18 KB | dsnopek |
Comments
Comment #2
dsnopekHere's a patch that adds specific support for public and private files so that they can both be made relative in ways that make sense for them
Comment #3
queenvictoria CreditAttribution: queenvictoria at Holly commentedWorks perfectly.
Comment #4
anonThanks for patch.