mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
we shouldn't quote when adding media
- utf8/unicode is valid in the src string, provided we escape quotes - and we escape when setting fields in the editor, leading to double escaping if we do that - and we strip quotes when adding
This commit is contained in:
parent
26f513a7a7
commit
35764757eb
1 changed files with 3 additions and 3 deletions
|
@ -851,7 +851,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">' % urllib.quote(name.encode("utf8"))
|
return '<img src="%s">' % name
|
||||||
else:
|
else:
|
||||||
anki.sound.play(name)
|
anki.sound.play(name)
|
||||||
return '[sound:%s]' % name
|
return '[sound:%s]' % name
|
||||||
|
@ -1147,8 +1147,8 @@ class EditorWebView(AnkiWebView):
|
||||||
finally:
|
finally:
|
||||||
self.editor.mw.progress.finish()
|
self.editor.mw.progress.finish()
|
||||||
path = unicode(urllib2.unquote(url.encode("utf8")), "utf8")
|
path = unicode(urllib2.unquote(url.encode("utf8")), "utf8")
|
||||||
path = path.replace("#", "")
|
for badChar in "#%\"":
|
||||||
path = path.replace("%", "")
|
path = path.replace(badChar, "")
|
||||||
path = namedtmp(os.path.basename(path))
|
path = namedtmp(os.path.basename(path))
|
||||||
file = open(path, "wb")
|
file = open(path, "wb")
|
||||||
file.write(filecontents)
|
file.write(filecontents)
|
||||||
|
|
Loading…
Reference in a new issue