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