Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29749

Extension of uploaded file changes due to multiple dots in the filename

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.5
    • Component/s: Files API, Repositories
    • Labels:
    • Environment:
      centos 5.x x86_64, postgres 8.4, apache 2.2.x php 5.3.x
    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      Test pre-requisites

      • Feel destructive
      • Create the following files:
        • myfile...txt
        • myfile.f..txt
        • myfile..f.txt
        • . . .txt
        • blah.jpg...
      • Create a few other files with random dots inside.

      Test steps

      1. Go to your private files
      2. Upload the above created files
      3. Make sure each file keeps its original extension
      4. Make sure the file names are cleaned up as expected
      5. Upload the attached zip file `funkynames.zip`, and unzip it
      6. Make sure the files and folders names are as the originals (you'll have to click on each file/folder to check the white spaces)
      Show
      Test pre-requisites Feel destructive Create the following files: myfile...txt myfile.f..txt myfile..f.txt . . .txt blah.jpg... Create a few other files with random dots inside. Test steps Go to your private files Upload the above created files Make sure each file keeps its original extension Make sure the file names are cleaned up as expected Upload the attached zip file `funkynames.zip`, and unzip it Make sure the files and folders names are as the originals (you'll have to click on each file/folder to check the white spaces)
    • Workaround:
      Hide

      Rename the file after uploading, then the multiple dots work again.

      Show
      Rename the file after uploading, then the multiple dots work again.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-29749-master-4th

      Description

      What happens:
      -------------------------------------------
      Let's assume we have a filename with multiple dots at the end of the filename before the extension, like for example foo_bar_e.g..txt
      (the e.g. has a dot at the end and the dot of the extension follows). After the fileupload with the upload repository, the file is stored as foo_bar_e.gtxt.

      Expected Behaviour:
      -------------------------------------------
      Filenames with mutliple dots should be uploaded faithfully (as long as the filename is valid, of course).

      Remark:
      -------------------------------------------
      This is especially a problem if the multiple dots are near the extension so that the extension changes. If - for example - an extension changes from .a..pdf to .apdf, then the file is no longer identified as a pdf file and users are left confused.

      Replication steps:
      a.) Generate a file with multiple dots near the extension (examples: foo..bar.gz or foor_bar.e.g..pdf)
      b.) Upload using the upload repository
      c.) find the extension changed

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/13