FileDecrypter: do not create object url in render
This commit is contained in:
parent
1140040bcc
commit
7966135ac7
|
@ -36,6 +36,10 @@ class FileDecrypter extends React.Component
|
||||||
mime: mime
|
mime: mime
|
||||||
length: parseInt resp.headers.get 'content-length'
|
length: parseInt resp.headers.get 'content-length'
|
||||||
|
|
||||||
|
componentWillUnmount: ->
|
||||||
|
if @state.downloaded
|
||||||
|
URL.revokeObjectURL @state.downloaded
|
||||||
|
|
||||||
downloadFile: =>
|
downloadFile: =>
|
||||||
@setState
|
@setState
|
||||||
downloading: true
|
downloading: true
|
||||||
|
@ -65,7 +69,8 @@ class FileDecrypter extends React.Component
|
||||||
type: @state.mime
|
type: @state.mime
|
||||||
@setState
|
@setState
|
||||||
decrypting: false
|
decrypting: false
|
||||||
downloaded: blob
|
blob: blob
|
||||||
|
downloaded: URL.createObjectURL blob
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
<div className="content-pastebin">{
|
<div className="content-pastebin">{
|
||||||
|
@ -95,7 +100,7 @@ class FileDecrypter extends React.Component
|
||||||
# on a hidden link, because on some browsers it doesn't work
|
# on a hidden link, because on some browsers it doesn't work
|
||||||
<a
|
<a
|
||||||
className="button-blue"
|
className="button-blue"
|
||||||
href={URL.createObjectURL @state.downloaded}
|
href={@state.downloaded}
|
||||||
download={@state.name}
|
download={@state.name}
|
||||||
>
|
>
|
||||||
Save File
|
Save File
|
||||||
|
|
Loading…
Reference in a new issue