a png file in a URL like this
domain.com/αβγ.png
seems to be valid for any browser
but when you copy paste in the REMOTE URL it becomes
domain.com/%CE%B1%CE%B2%CE%B3.png

and it does not allow the transfer with the following message
The specified file png. could not be uploaded. Only files with the following extensions are allowed: txt jpg png jpeg gif pdf doc docx xls xlsx.

Comments

GiorgosK created an issue. See original summary.

giorgosk’s picture

Have to also add that the default file upload functiality of core drupal can upload the file
and if the file is rename to LATIN characters it can be uploaded from REMOTE URL
so it sounds like a bug

seaji’s picture

StatusFileSize
new2.08 KB

Here is patch but it is for 7.x version.
Module uses basename() function
Should use drupal_basename()

karaoglanoglou’s picture

I have applied the patch (7.x-1.11), but it still doesn't work.

Did anyone manage to make it work?

gnuget’s picture

Status: Active » Needs review
StatusFileSize
new1.5 KB
new2.51 KB

I've worked on this today and these are my findings:

filefield_sources uses pathinfo to get the name of the file, the problem with this is that pathinfo rely in the locale to get the correct name of the file.

So, in theory setting the locale (using setlocale) somewhere in the code (a custom module or maybe in the settings.php) will fix this, I tried and it worked for me, there are even a few patches in other modules with a similar problem and the workaround is actually set a temporary locale to allow the code to get the data correctly.

Not sure how good is to rely in a generic locale it might break in specific enviroments, maybe the best thing if we want to preserve the filename is document how to set a locale and allow the user to set the correct locale depending their server.

Another idea is to take advantage of the transliteration class that is now part of core.

So, I decided to use transliteration approach.

Patch attached.

  • gnuget committed 9b3bd4e on 8.x-1.x
    Issue #2837000 by gnuget, seaji: remote URL with UTF8 characters can't...
gnuget’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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