mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
escape path to images
This commit is contained in:
parent
6f59cc7cd2
commit
876c16d413
1 changed files with 4 additions and 2 deletions
|
@ -8,7 +8,7 @@ from anki.sound import playFromText, stripSounds
|
|||
from anki.latex import renderLatex, stripLatex
|
||||
from ankiqt import ui
|
||||
|
||||
import re, os, sys
|
||||
import re, os, sys, urllib
|
||||
import ankiqt
|
||||
|
||||
def openLink(link):
|
||||
|
@ -178,7 +178,9 @@ def mungeQA(deck, txt):
|
|||
prefix = u"file:///"
|
||||
else:
|
||||
prefix = u"file://"
|
||||
src = prefix + os.path.join(deck.mediaDir(create=True), match)
|
||||
src = prefix + unicode(
|
||||
urllib.quote(os.path.join(deck.mediaDir(
|
||||
create=True), match).encode("utf-8")), "utf-8")
|
||||
return 'img src="%s"' % src
|
||||
txt = re.sub('img src="(.*?)"', quote, txt)
|
||||
return txt
|
||||
|
|
Loading…
Reference in a new issue