Skip to content

Commit

Permalink
Append random boundary to filenames - rapp-project/rapp-platform#295
Browse files Browse the repository at this point in the history
  • Loading branch information
klpanagi committed May 20, 2016
1 parent 6a9c1a9 commit 7382fa3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions python/RappCloud/Objects/File.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ def serialize(self):


def make_tuple(self):
name = RandStrGen.create(self.__boundarySize)
return (self.__postfield, (name, open(self.__path)))
randStr = RandStrGen.create(self.__boundarySize)
name, ext = path.splitext(self.basename(self.__path))
filename = '.'.join((''.join((name, '-', randStr)), ext))
return (self.__postfield, (filename, open(self.__path)))


def basename(self, filepath):
"""! Return the basename of input filepath. """
return path.basename(filepath)


0 comments on commit 7382fa3

Please sign in to comment.