mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 14:47:12 -05: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
|
# hash and rename
|
||||||
csum = checksum(open(path, "rb").read())
|
csum = checksum(open(path, "rb").read())
|
||||||
newpath = "{}-{}{}".format(uname, csum, ext)
|
newpath = "{}-{}{}".format(uname, csum, ext)
|
||||||
|
if os.path.exists(newpath):
|
||||||
|
os.unlink(newpath)
|
||||||
os.rename(path, newpath)
|
os.rename(path, newpath)
|
||||||
|
|
||||||
# add to media and return resulting html link
|
# add to media and return resulting html link
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue