From 3dcdddf039bcdfabcb19de72b1ccf01a6afd3e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Thu, 17 Jul 2014 14:41:44 +0200 Subject: [PATCH] 07837: Incorrect media path when using drag & drop; backport from gramps41; incomplete for non-ascii path or filename --- gramps/gui/editors/displaytabs/gallerytab.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gramps/gui/editors/displaytabs/gallerytab.py b/gramps/gui/editors/displaytabs/gallerytab.py index 19e8269a4..7ef1eff19 100644 --- a/gramps/gui/editors/displaytabs/gallerytab.py +++ b/gramps/gui/editors/displaytabs/gallerytab.py @@ -523,13 +523,14 @@ class GalleryTab(ButtonTab, DbGUIElement): d = conv_to_unicode((file.replace('\0',' ').strip()), None) protocol, site, mfile, j, k, l = urlparse(d) if protocol == "file": - mime = get_type(mfile) + name = url2pathname(mfile) + mime = get_type(name) if not is_valid_type(mime): return photo = MediaObject() base_dir = cuni(media_path(self.dbstate.db)) if os.path.exists(base_dir): - name = relative_path(mfile, base_dir) + name = relative_path(name, base_dir) photo.set_path(name) photo.set_mime_type(mime) basename = os.path.basename(name)