Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26554

Fatal error if you try to download files named with non ASCII characters

    XMLWordPrintable

Details

    Description

      If you try to download a file with non ASCII characters – wontÆØÅwork.svg – you will get a 500 Internal Server Error.

      By checking the logs, you will find this:

      request.CRITICAL:
      Uncaught PHP Exception InvalidArgumentException: "The filename fallback must only contain ASCII characters." at /var/www/ez-001/2016/app/bootstrap.php.cache line 1998

      {"exception":"[object] (
      InvalidArgumentException(code: 0):
      The filename fallback must only contain ASCII characters.
      at /var/www/ez-001/2016/app/bootstrap.php.cache:1998
      )"}

      The error seems to come from the ResponseHeaderBag.php file:

      Symfony/Component/HttpFoundation/ResponseHeaderBag.php
       * @param string $filenameFallback A string containing only ASCII characters that
       *     is semantically equivalent to $filename. If the filename is already ASCII,
       *     it can be omitted, or just copied from $filename
      public function makeDisposition($disposition, $filename, $filenameFallback = '') 
      {   
      ...
      	// filenameFallback is not ASCII.
      	if (!preg_match('/^[\x20-\x7e]*$/', $filenameFallback)) {
      		throw new \InvalidArgumentException('The filename fallback must only contain ASCII characters.');
      	}
      

      I'm not sure why the name wasn't normalized.

      Steps to reproduce.
      1. Choose any file and rename it to wontÆØÅwork.ext
      2. Open the admin interface, create a new file and upload wontÆØÅwork.ext
      3. Open that content object with the wontÆØÅwork.ext in the frontend, and try to download it.

      Attachments

        Activity

          People

            Unassigned Unassigned
            eduardo.fernandes-obsolete@ez.no Eduardo Fernandes (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: