for 989, updated folder cannot be renamed to empty string
This commit is contained in:
parent
4861c03e36
commit
1e5a2b7c51
1 changed files with 6 additions and 14 deletions
|
@ -68,20 +68,12 @@ export class FileNode extends React.Component {
|
||||||
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;
|
const newFileName = this.props.name;
|
||||||
if (oldFileExtension && !newFileExtension) {
|
const hasNoExtension = oldFileExtension && !newFileExtension;
|
||||||
this.props.updateFileName(this.props.id, this.originalFileName);
|
const notSameExtension = oldFileExtension && newFileExtension &&
|
||||||
}
|
oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase();
|
||||||
if (
|
const hasEmptyFilename = newFileName === '';
|
||||||
oldFileExtension &&
|
const hasOnlyExtension = newFileExtension && newFileName === newFileExtension[0];
|
||||||
newFileExtension &&
|
if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension) {
|
||||||
oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase()
|
|
||||||
) {
|
|
||||||
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);
|
this.props.updateFileName(this.props.id, this.originalFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue