mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression that broke DnD of files having a # character in their names to the book details panel
This commit is contained in:
parent
b69fb230c5
commit
880d360e0d
@ -130,6 +130,10 @@ def data_as_string(f, md):
|
|||||||
pass
|
pass
|
||||||
return raw
|
return raw
|
||||||
|
|
||||||
|
def path_from_qurl(qurl):
|
||||||
|
raw = bytes(bytearray(qurl.encodedPath()))
|
||||||
|
return urllib.unquote(raw).decode('utf-8')
|
||||||
|
|
||||||
def dnd_has_extension(md, extensions):
|
def dnd_has_extension(md, extensions):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
prints('Debugging DND event')
|
prints('Debugging DND event')
|
||||||
@ -143,7 +147,7 @@ def dnd_has_extension(md, extensions):
|
|||||||
if md.hasUrls():
|
if md.hasUrls():
|
||||||
urls = [unicode(u.toString()) for u in
|
urls = [unicode(u.toString()) for u in
|
||||||
md.urls()]
|
md.urls()]
|
||||||
paths = [urlparse(u).path for u in urls]
|
paths = [path_from_qurl(u) for u in md.urls()]
|
||||||
exts = frozenset([posixpath.splitext(u)[1][1:].lower() for u in
|
exts = frozenset([posixpath.splitext(u)[1][1:].lower() for u in
|
||||||
paths if u])
|
paths if u])
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user