mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
don't error if pasted image in temp folder
https://anki.tenderapp.com/discussions/ankidesktop/25805-anki-21-error-reporting
This commit is contained in:
parent
64b55f0e55
commit
baae899864
1 changed files with 2 additions and 0 deletions
|
@ -855,6 +855,8 @@ class EditorWebView(AnkiWebView):
|
|||
# hash and rename
|
||||
csum = checksum(open(path, "rb").read())
|
||||
newpath = "{}-{}{}".format(uname, csum, ext)
|
||||
if os.path.exists(newpath):
|
||||
os.unlink(newpath)
|
||||
os.rename(path, newpath)
|
||||
|
||||
# add to media and return resulting html link
|
||||
|
|
Loading…
Reference in a new issue