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
@ -112,6 +112,7 @@ class MediaManager:
|
||||
type_map = {
|
||||
"image/jpeg": ".jpg",
|
||||
"image/png": ".png",
|
||||
"image/svg+xml": ".svg",
|
||||
}
|
||||
if content_type in type_map:
|
||||
fname += type_map[content_type]
|
||||
|
@ -837,6 +837,8 @@ to a cloze type first, via Edit>Change Note Type."""
|
||||
# strip off any query string
|
||||
url = re.sub(r"\?.*?$", "", url)
|
||||
fname = os.path.basename(urllib.parse.unquote(url))
|
||||
if not fname.strip():
|
||||
fname = "paste"
|
||||
if content_type:
|
||||
fname = self.mw.col.media.add_extension_based_on_mime(fname, content_type)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user