mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 23:42: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 aqt
|
||||||
import anki.js
|
import anki.js
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
import urllib
|
||||||
|
|
||||||
# fixme: when tab order returns to the webview, the previously focused field
|
# 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
|
# 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
|
# return a local html link
|
||||||
ext = name.split(".")[-1].lower()
|
ext = name.split(".")[-1].lower()
|
||||||
if ext in pics:
|
if ext in pics:
|
||||||
return '<img src="%s">' % name
|
return '<img src="%s">' % urllib.quote(name)
|
||||||
else:
|
else:
|
||||||
anki.sound.play(name)
|
anki.sound.play(name)
|
||||||
return '[sound:%s]' % name
|
return '[sound:%s]' % name
|
||||||
|
@ -1087,6 +1088,8 @@ class EditorWebView(AnkiWebView):
|
||||||
ext = url.split(".")[-1].lower()
|
ext = url.split(".")[-1].lower()
|
||||||
if ext not in pics and ext not in audio:
|
if ext not in pics and ext not in audio:
|
||||||
return
|
return
|
||||||
|
if url.lower().startswith("file:/"):
|
||||||
|
url = urllib.quote(url, safe="/:")
|
||||||
# fetch it into a temporary folder
|
# fetch it into a temporary folder
|
||||||
self.editor.mw.progress.start(immediate=True)
|
self.editor.mw.progress.start(immediate=True)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue