Skip to content

Commit 2c9fd98

Browse files
committed
Handle whitespace in file name validation
1 parent 72622df commit 2c9fd98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/modules/IDE/components/FileNode.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ export class FileNode extends React.Component {
116116
const hasExtensionIfFolder = this.props.fileType === 'folder' && hasPeriod;
117117
const notSameExtension = oldFileExtension && newFileExtension
118118
&& oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase();
119-
const hasEmptyFilename = updatedName === '';
120-
const hasOnlyExtension = newFileExtension && updatedName === newFileExtension[0];
119+
const hasEmptyFilename = updatedName.trim() === '';
120+
const hasOnlyExtension = newFileExtension && updatedName.trim() === newFileExtension[0];
121121
if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder) {
122122
this.setUpdatedName(currentName);
123123
} else {

0 commit comments

Comments
 (0)