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

Mimetype basename and extension detection error with multiple extensions

    XMLWordPrintable

Details

    Description

      When you use WebDAV with eZ Publish you can configure eZ Publish to generate the name based on different options. One of them is to use the original basename which is also the default for files uploaded. See upload.ini:

      [file_ClassSettings]
      FileAttribute=file
      NameAttribute=name
      NamePattern=<original_filename_base>

      When you have files that use multiple extensions, e.g. ezoe.ini.append.php, it will detect the base name and suffix wrong.

      The error is in the mimetype class:
      $mimeData = eZMimeType::findByFileContents( "/www/ezoe.ini.append.php" );

      which has the following output in this case:
      array(10) {
      ["name"]=>
      string(24) "application/octet-stream"
      ["url"]=>
      string(24) "/www/ezoe.ini.append.php"
      ["filename"]=>
      string(19) "ezoe.ini.append.php"
      ["dirpath"]=>
      string(4) "/www"
      ["basename"]=>
      string(4) "ezoe"
      ["suffix"]=>
      string(14) "ini.append.php"
      ["prefix"]=>
      bool(false)
      ["suffixes"]=>
      bool(false)
      ["prefixes"]=>
      bool(false)
      ["is_valid"]=>
      bool(false)
      }

      The correct output would be to have basename ezoe.ini.append and extension "php".

      This affects WebDAV setups where you are not able to get the original filename as the object name as it will remove .ini.append from the display name. If you use original_filename you get double .php.php in WebDAV since it is adding the suffix. In other words there is no way of having the file appear with the name you uploaded it with in the case of multiple extensions/suffixes, which is what you want when using it as a shared file repository.

      Attachments

        Activity

          People

            unknown unknown
            bf bf
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: