favour urls over images in local file case

fixes copying&pasting from finder pasting icons instead of actual image

https://anki.tenderapp.com/discussions/ankidesktop/29082-found-several-issues-in-anki-21
This commit is contained in:
Damien Elmes 2018-08-08 12:46:51 +10:00
parent a389987530
commit 6cc9b5cde4

View File

@ -878,7 +878,14 @@ class EditorWebView(AnkiWebView):
html, internal = self._processHtml(mime) html, internal = self._processHtml(mime)
if html: if html:
return html, internal return html, internal
for fn in (self._processImage, self._processUrls, self._processText):
# favour url if it's a local link
if mime.hasUrls() and mime.urls()[0].toString().startswith("file://"):
types = (self._processUrls, self._processImage, self._processText)
else:
types = (self._processImage, self._processUrls, self._processText)
for fn in types:
html = fn(mime) html = fn(mime)
if html: if html:
return html, False return html, False