Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/view/frame/clipboardbox.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/shell/view/frame/clipboardbox.py b/shell/view/frame/clipboardbox.py
index 1eb1684..3bef447 100644
--- a/shell/view/frame/clipboardbox.py
+++ b/shell/view/frame/clipboardbox.py
@@ -22,6 +22,7 @@ import hippo
import gtk
from sugar import util
+from sugar.objects import mime
from view.clipboardicon import ClipboardIcon
from sugar.clipboard import clipboardservice
@@ -104,6 +105,11 @@ class ClipboardBox(hippo.CanvasBox):
uri = urlparse.urlparse(uris[0])
path, file_name = os.path.split(uri.path)
+ root, ext = os.path.splitext(file_name)
+ if not ext or ext == '.':
+ mime_type = mime.get_for_file(uri.path)
+ file_name = root + '.' + mime.get_primary_extension(mime_type)
+
# Copy the file, as it will be deleted when the dnd operation finishes.
new_file_path = os.path.join(path, 'cb' + file_name)
shutil.copyfile(uri.path, new_file_path)