[Sugar-devel] [PATCH] Copying files multiple times results in bogus names. (SL#2060)

godiard at sugarlabs.org godiard at sugarlabs.org
Tue Nov 23 15:40:45 EST 2010


From: Gonzalo Odiard <godiard at gmail.com>

---
 src/jarabe/journal/model.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 81ca7d4..81d1663 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -529,8 +529,8 @@ def _get_file_name(title, mime_type):
 def _get_unique_file_name(mount_point, file_name):
     if os.path.exists(os.path.join(mount_point, file_name)):
         i = 1
+        name, extension = os.path.splitext(file_name)
         while len(file_name) <= 255:
-            name, extension = os.path.splitext(file_name)
             file_name = name + '_' + str(i) + extension
             if not os.path.exists(os.path.join(mount_point, file_name)):
                 break
-- 
1.7.1.1



More information about the Sugar-devel mailing list