Active
Project:
Search Files
Version:
6.x-1.6
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Aug 2008 at 16:28 UTC
Updated:
6 Feb 2009 at 14:50 UTC
See line 865: $output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
This will print out the link like 'http://base_url/my/full/unix/path/to/sites/default/files/my_file'
Need to figure out unix path up to file path, and then substr from there.
I hacked it in for a specific site like $item['link'] = substr($item['link'],'/my/full/unix/path/to/');, but this does not solve the issue well.
Comments
Comment #1
cmgui commentedI also have the same problem. I am using Private File System. Uploaded files go to /usr/files/.
Drupal resides in /usr/local/www/drupal/.
Search Files works but the download link does not work.
The link shows up as http://test.example.com/usr/files/filename.pdf
The correct URL should be http://test.example.com/system/files/filename.pdf
since i have configured my drupal to use the private file system.
This is how I 'fixed' it.
added this line after line 819 in search_files.module
// added this for private file system
$link = str_replace("/usr/files","/system/files",$link);
Works but this isn't good because it assumes i will be using Private File System forever.
Also, if Drupal is not installed on the root and is installed on a subfolder, i.e.,
http://test.example.com/drupal/ , Search Files links also fail to have the 'drupal' in the URL.
Thank you.
Comment #2
miruoss commentedI think you speak of different things. However, I had the same problem as mradcliffe. The way the links are created on the search result page is pretty ugly. I wonder why they didn't use the function l() provided by drupal to create links.
First of all the assumption on line 809 to have a leading slash in the link is wrong. The following code of lines 809 through 814 should be removed:
Furthermore the code mentioned by mradcliffe should be changed into:
btw: check_plain() and check_url() are no longer needed as they are done by l().
and: this does not handle the special case mentioned by cmgui