diff --git a/pylib/anki/media.py b/pylib/anki/media.py index 2d88ac543..c7731426c 100644 --- a/pylib/anki/media.py +++ b/pylib/anki/media.py @@ -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] diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 56416e279..c3f292e9f 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -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)