From b0bfb766d95cf7eeed2c56aa7a84c496f5f5a6f2 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 16 Apr 2011 10:27:03 -0500 Subject: [PATCH] when running get_unique_filepath, clean_listy_filepath from the get-go --- mediagoblin/storage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mediagoblin/storage.py b/mediagoblin/storage.py index 4dbb2cfd..d697276a 100644 --- a/mediagoblin/storage.py +++ b/mediagoblin/storage.py @@ -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: