mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-28 11:16:52 +01:00
fix (#36): edge case
This commit is contained in:
parent
acbae4b73a
commit
4b072b5f8f
1 changed files with 13 additions and 0 deletions
|
|
@ -88,6 +88,19 @@ export class ViewerPage extends React.Component {
|
|||
this.setState({isSaving: false, needSaving: false});
|
||||
return Promise.resolve();
|
||||
})
|
||||
.then(() => {
|
||||
return new Promise((done, err) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
this.setState({content: reader.result});
|
||||
done();
|
||||
};
|
||||
reader.onerror = (e) => {
|
||||
err({message: 'Internal error 500'});
|
||||
};
|
||||
reader.readAsText(file);
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
if(err && err.code === 'CANCELLED'){ return; }
|
||||
this.setState({isSaving: false});
|
||||
|
|
|
|||
Loading…
Reference in a new issue