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!

CommentFileSizeAuthor
#2 linkit-private-files-2922306-2.patch1.18 KBdsnopek
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dsnopek created an issue. See original summary.

dsnopek’s picture

Status: Active » Needs review
FileSize
1.18 KB

Here'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

queenvictoria’s picture

Status: Needs review » Reviewed & tested by the community

Works perfectly.

anon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for patch.

  • anon committed 0a66f88 on 7.x-3.x authored by dsnopek
    Issue #2922306 by dsnopek, anon: Direct links to private files are wrong
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.