07837: Incorrect media path when using drag & drop; backport from gramps41; incomplete for non-ascii path or filename
This commit is contained in:
parent
85fd4a8502
commit
3dcdddf039
@ -523,13 +523,14 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
|||||||
d = conv_to_unicode((file.replace('\0',' ').strip()), None)
|
d = conv_to_unicode((file.replace('\0',' ').strip()), None)
|
||||||
protocol, site, mfile, j, k, l = urlparse(d)
|
protocol, site, mfile, j, k, l = urlparse(d)
|
||||||
if protocol == "file":
|
if protocol == "file":
|
||||||
mime = get_type(mfile)
|
name = url2pathname(mfile)
|
||||||
|
mime = get_type(name)
|
||||||
if not is_valid_type(mime):
|
if not is_valid_type(mime):
|
||||||
return
|
return
|
||||||
photo = MediaObject()
|
photo = MediaObject()
|
||||||
base_dir = cuni(media_path(self.dbstate.db))
|
base_dir = cuni(media_path(self.dbstate.db))
|
||||||
if os.path.exists(base_dir):
|
if os.path.exists(base_dir):
|
||||||
name = relative_path(mfile, base_dir)
|
name = relative_path(name, base_dir)
|
||||||
photo.set_path(name)
|
photo.set_path(name)
|
||||||
photo.set_mime_type(mime)
|
photo.set_mime_type(mime)
|
||||||
basename = os.path.basename(name)
|
basename = os.path.basename(name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user