Needs work
Project:
FileField
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Aug 2011 at 05:39 UTC
Updated:
25 Feb 2016 at 00:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
quicksketchInstall http://drupal.org/project/transliteration.
This is still a bug that the # sign isn't converted into URL entity though. So we'll leave this open as a bug until I have time to confirm the problem.
Comment #2
tabvn commentedYes, you are right, i have convert use url encode (urlencode) , but i think this is mistake in filefield theme funciton
i hope FileField Dev Team, fixs this in next version.
Toan
Comment #3
quicksketchThis patch fixes up this problem. Apparently when using public files you have to manually encode the URL, as Drupal just assumes that the URL is okay otherwise. Private files are already encoded just fine.
Comment #4
quicksketchComment #6
basic commentedThis change appears to have broken URLs containing spaces. I have a few sites where the URLs are now getting double encoded. For example:
http://bec.orvsd.org/sites/bec.orvsd.org/files/A.1%201.docbecomes
http://bec.orvsd.org/sites/bec.orvsd.org/files/A.1%25201.docand http://bec.orvsd.org/sites/bec.orvsd.org/files/A.1%25201.doc results in the file not being accessible.
Commenting out / reverting this change fixes the problem for me. I am unsure how to fix this, using rawurlencode seems to break it more.
Comment #7
dooug commentedI also experienced issues with the ampersand character being double escaped in the file url of the generic file display.
I did not revert the previous commit, but noticed that the code was calling
drupal_urlencode()followed byfile_create_url($path), which callsurl()which also callsdrupal_urlencode(). So thedrupal_urlencode()in the theme_filefield_file() is unnecessary.Attached is a patch that removes that function and worked for me to prevent the double escaped file urls.
Comment #8
dooug commentedUpon further review and testing. I realized that my partially reverting the original patch from comment #3 wasn't a solution.
However, I did notice that the
theme_filefield_formatter_url_plain()function does the similar file url encoding with:http://cgit.drupalcode.org/filefield/tree/filefield_formatter.inc?h=6.x-...
So, it makes sense to use that
field_file_urlencode_path()function that is used elsewhere in the module, rather than the commited patch from comment #3.I tested this and confirmed it solves double escaped/encoded ampersands (&) and hashes (#). I've attached the patch.
Comment #9
dooug commentedChanged issue title for clarification.
Comment #10
herved commentedHello,
I think this issue still needs work for I got double encoded urls after updating from Filefield 6.x-3.9 to 6.x-3.13.
Also I noticed other issues in the same file.
filefield\filefield_formatter.inc:68 :
filefield\filefield_formatter.inc:120 :
Hervé
Comment #11
pwolanin commentedThe use of
drupal_urlencode()looks clearly incorrect since for public files the output should never depend on whether we are using clean urls.Patch in #8 looks like a reasonable fix, but it would be helpful to have some test cases even for manual verification, or better yet add a set of tests to \FileFieldTestCase
Comment #13
pwolanin commentedComment #14
mr.j commentedWhile installing this latest release my IDE flagged an error in theme_filefield_formatter_url_plain with an undeclared variable. Patch attached.