I have set module according to documentation. Server reindexed files. When searching a string in files, it finds right files, but urls of found files are bad.
Format of bad url: http://server/search/search_files/sites/default/files/filename.ext
How to set correct urls of found files?

Comments

jrglasgow’s picture

Assigned: Unassigned » jrglasgow
Status: Active » Needs review

When Search Files indexes the file it catalogs the full directory path on the server, when it returns the search page it takes the full path and removes the $_SERVER['DOCUMENT_ROOT'] from the full path, this should return a path relative to the server's Document Root looking something like this

/sites/default/files/file.ext

which would return a link like this

http://server/sites/default/files/filename.ext

It looks like for some reason your server's $_SERVER['DOCUMENT_ROOT'] variable included a trailing '/' and it removed that from the relative path for the file, so the relative path for the file looked like this

sites/default/files/file.ext

when this is turned into a link all web browsers interpret this to be relative to the current web page so

http://server/search/search_files/sites/default/files/filename.ext

exactly what you are getting.
I have created a fix for this and created a new release 6.x-1.3

If you don't mind me asking, What version of PHP are you running, web server, Operating
system, etc...

stem’s picture

Version: 6.x-1.2 » 6.x-1.3

It's OK. Thanks.

jrglasgow’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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