Fix files being downloaded with wrong info when link changed (e.g. menu item reused). #906

This commit is contained in:
ccd0 2016-05-16 22:38:20 -07:00
parent d44b206e44
commit 0ed0aed6a2

View File

@ -82,11 +82,17 @@ ImageCommon =
download: (e) -> download: (e) ->
return true if @protocol is 'blob:' return true if @protocol is 'blob:'
e.preventDefault() e.preventDefault()
CrossOrigin.file @href, (blob) => {href, download} = @
CrossOrigin.file href, (blob) ->
if blob if blob
@href = URL.createObjectURL blob a = $.el 'a',
@click() href: URL.createObjectURL(blob)
download: download
hidden: true
$.add d.body, a
a.click()
$.rm a
else else
new Notice 'warning', "Could not download #{@href}", 20 new Notice 'warning', "Could not download #{href}", 20
return ImageCommon return ImageCommon