🐛 fix filename allowing empty/invalid strings

This commit is contained in:
ghalestrilo 2020-04-16 13:08:30 -03:00
parent c4d52457e5
commit fe9d75be8e

View file

@ -49,7 +49,7 @@ export class FileNode extends React.Component {
} }
get updatedName() { get updatedName() {
return this.state.updatedName || this.props.name; return this.state.updatedName;
} }
commitFileNameChange() { commitFileNameChange() {
@ -92,7 +92,6 @@ export class FileNode extends React.Component {
const hasOnlyExtension = newFileExtension && newFileName === newFileExtension[0]; const hasOnlyExtension = newFileExtension && newFileName === newFileExtension[0];
if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder) { if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder) {
this.setState({ updatedName: this.originalFileName }); this.setState({ updatedName: this.originalFileName });
this.props.updateFileName(this.props.id, this.originalFileName);
} else this.commitFileNameChange(); } else this.commitFileNameChange();
} }