Skip to content

Commit 76bd09b

Browse files
committed
for processing#989, files cannot be renamed to empty string
1 parent cdf1585 commit 76bd09b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

client/modules/IDE/components/FileNode.jsx

+7
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export class FileNode extends React.Component {
6767
validateFileName() {
6868
const oldFileExtension = this.originalFileName.match(/\.[0-9a-z]+$/i);
6969
const newFileExtension = this.props.name.match(/\.[0-9a-z]+$/i);
70+
const newFileName = this.props.name;
7071
if (oldFileExtension && !newFileExtension) {
7172
this.props.updateFileName(this.props.id, this.originalFileName);
7273
}
@@ -77,6 +78,12 @@ export class FileNode extends React.Component {
7778
) {
7879
this.props.updateFileName(this.props.id, this.originalFileName);
7980
}
81+
if (newFileName === '') {
82+
this.props.updateFileName(this.props.id, this.originalFileName);
83+
}
84+
if (newFileName === newFileExtension[0]) {
85+
this.props.updateFileName(this.props.id, this.originalFileName);
86+
}
8087
}
8188

8289
toggleFileOptions(e) {

0 commit comments

Comments
 (0)