fix app crash when file name can't be found

This commit is contained in:
Sean Yesmunt 2020-08-05 13:07:52 -04:00
parent c4e6605ada
commit 1854710093

View file

@ -310,7 +310,7 @@ function PublishFile(props: Props) {
filePath: file.path || file,
};
// Strip off extention and replace invalid characters
let fileName = name || file.name.substr(0, file.name.lastIndexOf('.')) || file.name;
let fileName = name || (file.name && file.name.substr(0, file.name.lastIndexOf('.'))) || '';
if (!isStillEditing) {
publishFormParams.name = parseName(fileName);