biigle/user-storage

Escape directory and file names

Closed this issue · 0 comments

mzur commented

We had a user who created a single directory with a name like "C:\Users\Student\Desktop\Volume\Station 1\Plattform 3\84\Video (connected)" (including the "). This caused several issues:

  • The backslashes are not interpreted as directory separators by the JS. They probably should be (converted to /), so multiple directories would be created in the case above.
  • Backslashes were interpreted as directory separators by the storage backend, so the storage request thought the prefix was a single directory but actually there were nested directories in the backend. See below for a fix.
  • Backslashes and other special characters (which ones? see below) in a directory (or file) name should be rejected by the API.
  • Special characters such as ", ' or whitespace (what else?) should be trimmed by the JS.
  • Special characters that are not valid for directory or filenames should be removed by the JS.