when running get_unique_filepath, clean_listy_filepath from the get-go
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 16 Apr 2011 15:27:03 +0000 (10:27 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 16 Apr 2011 15:27:03 +0000 (10:27 -0500)
mediagoblin/storage.py

index 4dbb2cfd9de0f7f9a1f38bdb5635e0b16a5d0a5a..d697276a4c6abd5bc8543e8cee57bb826429d301 100644 (file)
@@ -126,6 +126,10 @@ class StorageInterface(object):
         >>> storage_handler.get_unique_filename(['dir1', 'dir2', 'fname.jpg'])
         [u'dir1', u'dir2', u'd02c3571-dd62-4479-9d62-9e3012dada29-fname.jpg']
         """
+        # Make sure we have a clean filepath to start with, since
+        # we'll be possibly tacking on stuff to the filename.
+        filepath = clean_listy_filepath(filepath)
+
         if self.file_exists(filepath):
             return filepath[:-1] + ["%s-%s" % (uuid.uuid4(), filepath[-1])]
         else: