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

Gonzalo Odiard gonzalo at laptop.org
Wed Nov 10 15:57:18 EST 2010


Mhh, is sufficient with doing the split out of the while

Gonzalo


[gonzalo at nautilus journal]$ git diff model.py
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 81ca7d4..a422f6b 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -528,9 +528,9 @@ 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)):
+        name, extension = os.path.splitext(file_name)
         i = 1
         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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20101110/fe313d43/attachment.html>


More information about the Dextrose mailing list