mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 10:22:31 +01:00
Bug fixes
Fix null error if unknown filetype. Handle ENOENT: Windows will throw error with code ENOENT if format detection fails.
This commit is contained in:
parent
37398cd273
commit
a1a2e0f46c
@ -78,7 +78,7 @@ function getFormat(filePath) {
|
|||||||
return readChunk(filePath, 0, 262)
|
return readChunk(filePath, 0, 262)
|
||||||
.then((bytes) => {
|
.then((bytes) => {
|
||||||
const ft = fileType(bytes);
|
const ft = fileType(bytes);
|
||||||
if (_.includes(formats, ft.ext)) return ft.ext;
|
if (_.includes(formats, (ft || {}).ext)) return ft.ext;
|
||||||
return formats[0] || undefined;
|
return formats[0] || undefined;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -78,7 +78,7 @@ class App extends React.Component {
|
|||||||
return this.setState({ filePath, fileFormat });
|
return this.setState({ filePath, fileFormat });
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.code === 1) {
|
if (err.code === 1 || err.code === 'ENOENT') {
|
||||||
alert('Unsupported file');
|
alert('Unsupported file');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user