commit
0bba096775
@ -429,6 +429,7 @@ class AnkiConnect:
|
|||||||
self.deleteMediaFile(filename)
|
self.deleteMediaFile(filename)
|
||||||
self.media().writeData(filename, base64.b64decode(data))
|
self.media().writeData(filename, base64.b64decode(data))
|
||||||
elif url:
|
elif url:
|
||||||
|
self.deleteMediaFile(filename)
|
||||||
downloadedData = util.download(url)
|
downloadedData = util.download(url)
|
||||||
self.media().writeData(filename, downloadedData)
|
self.media().writeData(filename, downloadedData)
|
||||||
else:
|
else:
|
||||||
@ -450,7 +451,10 @@ class AnkiConnect:
|
|||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
def deleteMediaFile(self, filename):
|
def deleteMediaFile(self, filename):
|
||||||
self.media().syncDelete(filename)
|
try:
|
||||||
|
self.media().syncDelete(filename)
|
||||||
|
except AttributeError:
|
||||||
|
self.media().trash_files([filename])
|
||||||
|
|
||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
|
Loading…
Reference in New Issue
Block a user