fix copying images with filenames containing reserved chars (#3775)

This commit is contained in:
llama 2025-01-27 21:57:31 +08:00 committed by GitHub
parent b65fa693da
commit 00501c267c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1105,7 +1105,8 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
# with allowed_suffixes=pics, all non-pics will be rendered as <a>s and won't be included here # with allowed_suffixes=pics, all non-pics will be rendered as <a>s and won't be included here
if not (images := self.mw.col.media.files_in_str(self.note.mid, html)): if not (images := self.mw.col.media.files_in_str(self.note.mid, html)):
return None return None
return os.path.join(self.mw.col.media.dir(), images[0]) image_path = urllib.parse.unquote(images[0])
return os.path.join(self.mw.col.media.dir(), image_path)
def select_image_from_clipboard_and_occlude(self) -> None: def select_image_from_clipboard_and_occlude(self) -> None:
"""Set up the mask editor for the image in the clipboard.""" """Set up the mask editor for the image in the clipboard."""