From fff0daf8c4aef388f12f801162a050f13acd6cb8 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Mon, 20 Aug 2007 08:50:20 +0000 Subject: Improvements in mime handling and added some tests. --- (limited to 'services/shell') diff --git a/services/shell/clipboardobject.py b/services/shell/clipboardobject.py index 65f3bc5..c3cdab3 100644 --- a/services/shell/clipboardobject.py +++ b/services/shell/clipboardobject.py @@ -101,8 +101,11 @@ class ClipboardObject: if len(uris) == 1 or not uris[1]: uri = urlparse.urlparse(uris[0], 'file') if uri.scheme == 'file': - logging.debug('Choosed %r!' % mime.get_for_file(uri.path)) - format = mime.get_for_file(uri.path) + if os.path.exists(uri.path): + format = mime.get_for_file(uri.path) + else: + format = mime.get_from_file_name(uri.path) + logging.debug('Choosed %r!' % format) return format -- cgit v0.9.1