Commit 5f833d2b authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis

file: Fix uploading from Windows

Up until now, if a user uploads a directory recursively from
a Windows machine, then the following file structure will be
stored in pithos:

   D dir1/
 10B dir1/dir2/dir3/file
   D dir1\dir2/
   D dir1\dir2\dir3

Downloading this structure from a Linux machine is impossible
because the following directories are created locally:

  dir1
  dir1\dir2
  dir1\dir2\dir3

This way the file cannot be stored under dir1/dir2/dir3 which
does not exist.

Fix this by storing all paths with '/' as a separator in Pithos,
rather than '\'.
Signed-off-by: default avatarDimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
parent df9a6a57
......@@ -1019,6 +1019,9 @@ class file_upload(_PithosContainer):
rel_path = rpath + top.split(lpath)[1]
except IndexError:
rel_path = rpath
# Use the '/' separator for directories that
# are about to be created in Pithos
rel_path = rel_path.replace(path.sep, '/')
self.error('remote: mkdir /%s/%s' % (
self.client.container, rel_path))
self.client.create_directory(rel_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment