Damien Elmes 2020-06-01 07:33:11 +10:00
parent caf95742da
commit 8516ed8655
2 changed files with 3 additions and 0 deletions

View File

@ -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]

View File

@ -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)