Merge pull request #153 from c-okelly/patch-1

Use new hook for delete
This commit is contained in:
Alex Yatskov 2020-04-09 10:11:19 -07:00 committed by GitHub
commit 0bba096775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -429,6 +429,7 @@ class AnkiConnect:
self.deleteMediaFile(filename)
self.media().writeData(filename, base64.b64decode(data))
elif url:
self.deleteMediaFile(filename)
downloadedData = util.download(url)
self.media().writeData(filename, downloadedData)
else:
@ -450,7 +451,10 @@ class AnkiConnect:
@util.api()
def deleteMediaFile(self, filename):
try:
self.media().syncDelete(filename)
except AttributeError:
self.media().trash_files([filename])
@util.api()