$filepath within the function _asa_get_attachment_text() is handled incorrectly and will not work with private file structures. I've utilized filefield's field_file_load() function to prove the concept. We can simply set filepath to $file['filepath'] when passed in this context. I will try to write up a more friendly patch for this today or tomorrow and see if we can get it working properly.
Eclipse
| Comment | File | Size | Author |
|---|
Comments
Comment #1
pwolanin commentedMaybe we shoudl use
file_create_path()?http://api.drupal.org/api/function/file_create_path/6
Comment #2
somebodysysop commentedHere is the issue, I believe:
I use private_upload.module which places private files in a "private" subdirectory of "files" directory. This module requires a "public" filesystem to work it's magic. From the nodes to which they are attached, these files are accessed using this link: "/system/files/private/".
However, when apachesolr_attachments lists these files, the links only have:
"/files/private/"
Therefore, all of these files return "access denied" when you try to link to them from apachesolr_attachments.
@EclipseGc: Did you ever complete that patch? Is it working? If so, could you provide it here?
Comment #3
somebodysysop commentedAny suggestions for this issue? Again, files that are not in the default "files" directory are indexed, but the link that apachesolr_attachments displays are incorrect.
Comment #4
pwolanin commentedEclipseGC has promised a patch...
Comment #5
eclipsegc commentedPatch as promised:
Comment #6
pwolanin commenteddo we need the leading '.'?
Seems like we might also be able to fix this using
$filepath = realpath($file->filepath);?Comment #7
pwolanin commentedI think this was fixed by http://drupal.org/node/490078 - please confirm
Comment #8
pwolanin commentedI think this is fixed - can anyone confirm?
Comment #9
somebodysysop commentedIt did not resolve the issue as far as private file links are concerned. Even with the patch, the url "files/private" is still returned, and users cannot access the file even if they have permission to do so.
I used hook_apachesolr_process_results() to ultimately fix the problem:
I do not know what other issue the patch was designed to fix.
Comment #10
pwolanin commentedso the existing code is:
perhaps your problem is with the logic in this function? http://api.drupal.org/api/function/file_create_url/6
Are you using a mix of public and private files?
Comment #11
somebodysysop commentedIt is a mix. But, upon greater reflection, I think the existing code is fine. The url created is, under normal circumstances, correct.
The private_upload.module appears to do some fancy footwork in nodeapi in order to correctly display public and private files attached to the same node:
The apachesolr_attachments.module can't be expected to support this.
I will instead recommend that the private_upload.module incorporate hook_apachesolr_process_results() to accomodate the necessary file url changes.
So, unless someone else has a problem with the apachesolr_attachments code, I would say this issue is fixed.
Thanks for the assistance here!
Comment #12
pwolanin commentedOk, so it's fixed?
Comment #14
Ajtis.pl commentedFix it in
template.php