Review main Merged

29202[BUGFIX] ResourceStorage does not sanitize folder/file name

Frans Saris CR +2 V +2 Normal +35 −31 updated 04/16/14, 19:36

Commit message

On multiple places the new folder or filename is not sanitized
before the checks are done to see if the a folder of file with
that name already exists.

This patch makes sure the new names gets sanitized first and
also takes care that the name of the resultObject is passed to
the PostFolderMove, PostFolderCopy and PostFolderRename signals.

Review

  • Code review CR +2
    • Francois Suter +2
    • Stefan Neufeind +1
    • Alexander Opitz +1
    • Stefan Froemken +1
  • Verified V +2
    • Francois Suter +2
    • Alexander Opitz +1
    • Stefan Froemken +1

Issues 1

Files 1

Review log 25

  1. Mr. Jenkins commented on patch set 1 04/06/14, 09:44

  2. Frans Saris uploaded patch set 2 04/07/14, 18:17

  3. Mr. Jenkins commented on patch set 2 04/07/14, 18:30

  4. Markus Klein commented on patch set 2 04/07/14, 18:40

    ResourceStorage.php:1726

    can be reduced to ?:
  5. Markus Klein voted on patch set 2 V +1 CR +1 04/07/14, 18:50

  6. Stefan Neufeind commented on patch set 2 04/13/14, 10:16

    ResourceStorage.php:1726 Reply

    sure. please do before commit
  7. Oliver Klee commented on patch set 2 CR -1 04/13/14, 10:20

    Coming up with a new patch in a minute.
    typo: sanitezed -> sanitized

    ResourceStorage.php:1824

    We should have a different name for this variable. Otherwise, you need to remember on reading which newName the code currently is about. (Overwriting parameters is a Code Smell, btw.)
  8. Oliver Klee uploaded patch set 3 04/13/14, 10:29

  9. Oliver Klee commented on patch set 3 04/13/14, 10:29

    Fixed the comments.
  10. Mr. Jenkins commented on patch set 3 04/13/14, 10:42

  11. Stefan Froemken uploaded patch set 4 04/15/14, 13:10

  12. Oliver Klee voted on patch set 4 CR +1 04/15/14, 13:12

  13. Stefan Froemken commented on patch set 4 04/15/14, 13:15

    I wonder a bit about the sanitize-process: Rename "Frömken.jpg" results in "froemken.jpg". Copy/Move a file called "Frömken.jpg" results in "fro__mken.jpg" in the other folder.
  14. Mr. Jenkins commented on patch set 4 04/15/14, 13:24

  15. Stefan Froemken voted on patch set 4 V +1 CR +1 04/15/14, 16:30

  16. Stefan Neufeind commented on patch set 4 CR +1 04/15/14, 16:34

    it says this needs a rebase. Should be good to go then imho.
  17. Frans Saris commented on patch set 4 04/15/14, 17:33

    will push rebased patch
  18. Frans Saris uploaded patch set 5 04/15/14, 17:41

  19. Mr. Jenkins commented on patch set 5 04/15/14, 17:54

  20. Stefan Froemken voted on patch set 5 V +1 CR +1 04/16/14, 06:42

  21. Stefan Neufeind voted on patch set 5 CR +1 04/16/14, 07:10

  22. Alexander Opitz voted on patch set 5 V +1 CR +1 04/16/14, 11:18

  23. Frans Saris commented on patch set 5 04/16/14, 16:53

    Some test cases: renaming a folder named "test" to "test 2" (after patch this should not give an error anymore) add a file through ftp/ssh with spaces in the name go to filemodule and copy/paste the file (after patch filename should be sanitized) add a file through ftp/ssh with spaces in the name go to filemodule and move the file (after patch filename should be sanitized) add a file through ftp/ssh with spaces in the name go to filemodule and renaming the file (after patch filename should be sanitized even if you try to rename to filename with spaces) add a file through ftp/ssh with spaces in the name go to filemodule and copy/paste the folder (after patch foldername should be sanitized) add a folder through ftp/ssh with spaces in the name go to filemodule and move the folder (after patch foldername should be sanitized)
  24. Francois Suter voted on patch set 5 V +2 CR +2 04/16/14, 19:36

  25. Francois Suter merged patch set 6 04/16/14, 19:36