Moodle
  1. Moodle
  2. MDL-28276

Folder: Inconsistent handling of (sub)folder names beginning in or ending with a dot

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Files API, Resource
    • Labels:
    • Workaround:
      Hide

      Avoid folder names that contain dots.

      Show
      Avoid folder names that contain dots.
    • Affected Branches:
      MOODLE_21_STABLE
    • Rank:
      17901

      Description

      In the edit screen for the "Folder" resource, in the "Content" section, it is possible to rename a (sub)folder to have a name that begins with, or ends in, a dot (.). However, when changing to this subfolder afterwards, the folder appears empty. See test instructions for details.

      Note that this problem appears for folder names like "test." and ".test" but not for "test.test" .

      Replication instructions:

      • Go to a Moodle course page, and turn editing on.
      • Click "Add a resource... Folder".
      • Go to the "content" section, click "Create Folder", type the name: "test", then click "OK".
      • Click on the folder name "test", and add a file to this folder.
      • Return to the main directory (click "Files").
      • Right-click on the "test" folder and choose "Rename".
      • As the new name, type "test." (note trailing dot), then click "OK".
      • Click on the folder "test." to open it.

      EXPECTED BEHAVIOUR: Title lines says "Path: Files > test.", contents of the folder are being displayed.
      ACTUAL BEHAVIOUR: Title line says "Path: Files > test", folder appears empty ("No files attached").

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this.

          I've put it on our backlog and we'll try to get to it as soon as we can.

          In the meantime adding more information, such as screenshots or even a code solution, will help us and other users.

          Show
          Michael de Raadt added a comment - Thanks for reporting this. I've put it on our backlog and we'll try to get to it as soon as we can. In the meantime adding more information, such as screenshots or even a code solution, will help us and other users.
          Hide
          Vadim Dvorovenko added a comment - - edited

          In your case the actual behaviour is correct. For example try to create 'test.' folder in windows - it will create 'test' folder. Even if you try to download file from this folder using link http://localhost/moodle/draftfile.php/5/user/draft/640441894/test./file.txt Apache and PHP will trim path to http://localhost/moodle/draftfile.php/5/user/draft/640441894/test/file.txt in $_SERVER[PATH_INFO]

          But all you are talking about is correct for filenames beginning with dots or containing dots.
          for example .test, ..test, ..te..st

          Show
          Vadim Dvorovenko added a comment - - edited In your case the actual behaviour is correct. For example try to create 'test.' folder in windows - it will create 'test' folder. Even if you try to download file from this folder using link http://localhost/moodle/draftfile.php/5/user/draft/640441894/test./file.txt Apache and PHP will trim path to http://localhost/moodle/draftfile.php/5/user/draft/640441894/test/file.txt in $_SERVER [PATH_INFO] But all you are talking about is correct for filenames beginning with dots or containing dots. for example .test, ..test, ..te..st
          Hide
          Henning Bostelmann added a comment -

          I can't quite see how the actual behaviour is correct - as it stands, you lose access to the contents of the folder, unless you rename it back from "test." to "test" .

          While the folder is called "test.", all its contents seem to be invisible, see the test case above.

          Show
          Henning Bostelmann added a comment - I can't quite see how the actual behaviour is correct - as it stands, you lose access to the contents of the folder, unless you rename it back from "test." to "test" . While the folder is called "test.", all its contents seem to be invisible, see the test case above.
          Hide
          Vadim Dvorovenko added a comment -

          Take a look at last comment at MDL-29749. I've placed patches here. It does not allow to file or folder have trailig spasces and dots, so if you try rename folder to 'test.' it will be named 'test'
          If you use patch and try '.test', '..test..test' all will work correctly, because such filenames are allowed.

          Show
          Vadim Dvorovenko added a comment - Take a look at last comment at MDL-29749 . I've placed patches here. It does not allow to file or folder have trailig spasces and dots, so if you try rename folder to 'test.' it will be named 'test' If you use patch and try '.test', '..test..test' all will work correctly, because such filenames are allowed.
          Hide
          Frédéric Massart added a comment -

          This issue should be fixed in the related one.

          Show
          Frédéric Massart added a comment - This issue should be fixed in the related one.
          Hide
          Frédéric Massart added a comment -

          Closing as confirmed to being fixed by MDL-29749.

          Show
          Frédéric Massart added a comment - Closing as confirmed to being fixed by MDL-29749 .

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: