mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
handle images served from directory + svg content type
https://anki.tenderapp.com/discussions/ankidesktop/41974-win-linux-when-pasting-some-html-i-get-error-in-_run_command-ankirsbackendioerror-ioerror
This commit is contained in:
parent
caf95742da
commit
8516ed8655
2 changed files with 3 additions and 0 deletions
|
@ -112,6 +112,7 @@ class MediaManager:
|
||||||
type_map = {
|
type_map = {
|
||||||
"image/jpeg": ".jpg",
|
"image/jpeg": ".jpg",
|
||||||
"image/png": ".png",
|
"image/png": ".png",
|
||||||
|
"image/svg+xml": ".svg",
|
||||||
}
|
}
|
||||||
if content_type in type_map:
|
if content_type in type_map:
|
||||||
fname += type_map[content_type]
|
fname += type_map[content_type]
|
||||||
|
|
|
@ -837,6 +837,8 @@ to a cloze type first, via Edit>Change Note Type."""
|
||||||
# strip off any query string
|
# strip off any query string
|
||||||
url = re.sub(r"\?.*?$", "", url)
|
url = re.sub(r"\?.*?$", "", url)
|
||||||
fname = os.path.basename(urllib.parse.unquote(url))
|
fname = os.path.basename(urllib.parse.unquote(url))
|
||||||
|
if not fname.strip():
|
||||||
|
fname = "paste"
|
||||||
if content_type:
|
if content_type:
|
||||||
fname = self.mw.col.media.add_extension_based_on_mime(fname, content_type)
|
fname = self.mw.col.media.add_extension_based_on_mime(fname, content_type)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue