🐛 fix filename allowing empty/invalid strings
This commit is contained in:
parent
c4d52457e5
commit
fe9d75be8e
1 changed files with 1 additions and 2 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue