mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
handle chrome's newlines in url issue and make sure to clean up progress
This commit is contained in:
parent
dbfe9529f9
commit
4884d0edf7
1 changed files with 4 additions and 1 deletions
|
@ -1022,6 +1022,8 @@ class EditorWebView(AnkiWebView):
|
|||
|
||||
def _processUrls(self, mime):
|
||||
url = mime.urls()[0].toString()
|
||||
# chrome likes to give us the URL twice with a \n
|
||||
url = url.splitlines()[0]
|
||||
link = self._localizedMediaLink(url)
|
||||
mime = QMimeData()
|
||||
mime.setHtml(link)
|
||||
|
@ -1093,11 +1095,12 @@ class EditorWebView(AnkiWebView):
|
|||
except urllib2.URLError, e:
|
||||
showWarning(self.errtxt % e)
|
||||
return
|
||||
finally:
|
||||
self.editor.mw.progress.finish()
|
||||
path = namedtmp(os.path.basename(urllib2.unquote(url)))
|
||||
file = open(path, "wb")
|
||||
file.write(filecontents)
|
||||
file.close()
|
||||
self.editor.mw.progress.finish()
|
||||
return self.editor._addMedia(path)
|
||||
|
||||
def _flagAnkiText(self):
|
||||
|
|
Loading…
Reference in a new issue