for #989, files cannot be renamed to empty string
This commit is contained in:
parent
f6416738ae
commit
b94ca8a52d
1 changed files with 7 additions and 0 deletions
|
@ -67,6 +67,7 @@ export class FileNode extends React.Component {
|
||||||
validateFileName() {
|
validateFileName() {
|
||||||
const oldFileExtension = this.originalFileName.match(/\.[0-9a-z]+$/i);
|
const oldFileExtension = this.originalFileName.match(/\.[0-9a-z]+$/i);
|
||||||
const newFileExtension = this.props.name.match(/\.[0-9a-z]+$/i);
|
const newFileExtension = this.props.name.match(/\.[0-9a-z]+$/i);
|
||||||
|
const newFileName = this.props.name;
|
||||||
if (oldFileExtension && !newFileExtension) {
|
if (oldFileExtension && !newFileExtension) {
|
||||||
this.props.updateFileName(this.props.id, this.originalFileName);
|
this.props.updateFileName(this.props.id, this.originalFileName);
|
||||||
}
|
}
|
||||||
|
@ -77,6 +78,12 @@ export class FileNode extends React.Component {
|
||||||
) {
|
) {
|
||||||
this.props.updateFileName(this.props.id, this.originalFileName);
|
this.props.updateFileName(this.props.id, this.originalFileName);
|
||||||
}
|
}
|
||||||
|
if (newFileName === '') {
|
||||||
|
this.props.updateFileName(this.props.id, this.originalFileName);
|
||||||
|
}
|
||||||
|
if (newFileName === newFileExtension[0]) {
|
||||||
|
this.props.updateFileName(this.props.id, this.originalFileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleFileOptions(e) {
|
toggleFileOptions(e) {
|
||||||
|
|
Loading…
Reference in a new issue