Filename encoding problem based on OS and browser combination

WP-Filebase Pro Forums General Support Filename encoding problem based on OS and browser combination

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4965
    Frederic
    Participant

    Hi,
    I believe I’ve stumble on an peculiar anomaly : a filename encoding problem leading to files that cannot be downloaded.
    It requires a curious combination but the problem is reproducible, at least I can reproduce it at will.
    The ingredients are : a filename with accented characters, MacOsX, Firefox to upload a file, and Safari to download a file.

    My setup :
    OsX 10.9.5
    Firefox 37, then Firefox 38.0.1
    Safari 7.1.5
    Local dev server : MAMP (Apache 2.2.21 ; PHP 5.3.6 ; MySQL 5.5.9)
    Production server : Debian 7 (Apache 2.2.22 ; PHP 5.4.39 ; MySQL 5.5.43)

    Two ways to reproduce the problem :
    1) via the upload form, on whatever page it may appear, on both local and dev server.
    – On OsX, using Firefox.
    – Take a file with accented character in its name (like “testé.jpg”)
    – Upload it to the website via the upload form.
    – Using Safari, browse the website to a page where you can download the file.
    – Trying to download the file leads to a 404 page.

    2) via filesystem sync, only really testable on local dev server (MAMP).
    – On OsX, with finder (the osx file browser), go to the filebase upload folder.
    – Put a file with accented character in its name.
    – With any web browser, go to filebase admin page and launch a file sync.
    – The file is detected and added to filebase.
    – Now, using Safari, browse the website to a page where you can download the file.
    – Trying to download the file leads to a 404 page.

    I’ve tried uploading the file using FF, Safari, Chrome, Opera and IE, on both Windows and OsX when applicable.
    The problem only occurs when the file has been uploaded from FF on OsX, or if the filesystem that hosts the website is HFS+, and only if the download is attempted with Safari.
    Osx’s filenames seem to be encoded in form D while on other file systems, it’s form C (http://stackoverflow.com/questions/773574/in-php-how-do-i-deal-with-the-difference-in-encoded-filena…)

    On the local website, hosted on MAMP, one way to circumvent this problem was to use the php5-Intl extension and add a normalization of the filename, for example when the file is fetched :
    // wp-filebase-pro/classes/Item.php ; line 94
    if (!Normalizer::isNormalized($path, Normalizer::FORM_D)) {
    $path = Normalizer::normalize($path, Normalizer::FORM_D);
    }

    It’s not a viable solution as the site can be on different filesystem, thus with different norm ; and it also requires intl to be installed and activated…

    Another way would be to sanitize the filename when the file is saved on disk and/or synched, removing all accents and whatnot.

    What do you think of all this ?

    #5001
    FredsENT
    Participant

    Hi,

    I also hab problems with accented characters. What resolved it was to mark the option “Disable download permalinks” in Settings/Download.

    It works fine for the files uploaded with a form. But, I still have a problem with files directly copied on the server disk (my WP runs on a IIs server under Windows Server 2012). When I want to synchronise the plugin, I have an error on the files with accented characters.

    #5122
    Fabian
    Participant

    Hi,
    there will be a fix with next version where invalid characters or accents/umlauts are removed or mapped to non-special characters.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.