mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
fix drag&drop of images with # char (#867)
This commit is contained in:
parent
1fb0c73e91
commit
e47da34cbc
1 changed files with 4 additions and 1 deletions
|
@ -14,6 +14,7 @@ from aqt.utils import shortcut, showInfo, showWarning, getBase, getFile, \
|
|||
import aqt
|
||||
import anki.js
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
import urllib
|
||||
|
||||
# fixme: when tab order returns to the webview, the previously focused field
|
||||
# is focused, which is not good when the user is tabbing through the dialog
|
||||
|
@ -807,7 +808,7 @@ to a cloze type first, via Edit>Change Note Type."""))
|
|||
# return a local html link
|
||||
ext = name.split(".")[-1].lower()
|
||||
if ext in pics:
|
||||
return '<img src="%s">' % name
|
||||
return '<img src="%s">' % urllib.quote(name)
|
||||
else:
|
||||
anki.sound.play(name)
|
||||
return '[sound:%s]' % name
|
||||
|
@ -1087,6 +1088,8 @@ class EditorWebView(AnkiWebView):
|
|||
ext = url.split(".")[-1].lower()
|
||||
if ext not in pics and ext not in audio:
|
||||
return
|
||||
if url.lower().startswith("file:/"):
|
||||
url = urllib.quote(url, safe="/:")
|
||||
# fetch it into a temporary folder
|
||||
self.editor.mw.progress.start(immediate=True)
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue