Broken download links when filtering with clean URLs (e.g. /biblio/year/2009)
Alexander Ufimtsev - March 24, 2009 - 22:14
| Project: | Bibliography Module |
| Version: | 5.x-1.16 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Alexander Ufimtsev |
| Status: | closed |
Jump to:
Description
When clean URLs are enabled on filtering, e.g. /biblio/author/Smith or /biblio/year/2009, download links for papers become incorrect, pointing to /biblio/author/Smith/files/file.pdf instead of /files/file.pdf. The following patch fixes the problem:
Index: biblio.module
===================================================================
--- biblio.module (revision 226)
+++ biblio.module (working copy)
@@ -2051,7 +2051,7 @@
$output .= ' '. t('Download') .': ';
$output .= '<span class="biblio_export_links">';
foreach ($node->files as $file) {
- $output .= ' <a href="' . $file->filepath . '">' . $file->filename . '</a> ';
+ $output .= ' <a href="' . file_create_url($file->filepath) . '">' . $file->filename . '</a> ';
}
$output .= '</span>';
}Please review.
| Attachment | Size |
|---|---|
| fix-biblio-download.patch | 596 bytes |

#1
Thanks for pointing that out, I'm surprised no one ran into this before.
I did something a little different than you suggested, I used the l() function instead like this...
$output .= ' '. l($file->filename, $file->filepath). ' ';Ron.
#2
Yes, l() seems to be more elegant, though both of l() and file_create_url() end up calling url() at the end of the day anyway. I'm also surprised that out of almost 300 installations we were the first to spot this bug.
Thank you, Ron!
Alexander
#3
FYI, I'm going to roll a new 5.x release later this week which will contain this fix as well as a few enhancements (some new styles: AMA, Chicago, MLA and Vancouver)
Ron.
#4
#5
Automatically closed -- issue fixed for 2 weeks with no activity.
#6
Hi Ron,
Any chance of a release any time soon?
A
#7
Oops, this one completely slipped my mind (and since it was automatically closed) it slipped off the radar screen, sorry about that.
#8
The new release is out now.
Ron.
#9
cheers! works perfectly!
#10
Automatically closed -- issue fixed for 2 weeks with no activity.