Handle whitespace in file name validation
This commit is contained in:
parent
72622df155
commit
2c9fd982d0
1 changed files with 2 additions and 2 deletions
|
@ -116,8 +116,8 @@ export class FileNode extends React.Component {
|
|||
const hasExtensionIfFolder = this.props.fileType === 'folder' && hasPeriod;
|
||||
const notSameExtension = oldFileExtension && newFileExtension
|
||||
&& oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase();
|
||||
const hasEmptyFilename = updatedName === '';
|
||||
const hasOnlyExtension = newFileExtension && updatedName === newFileExtension[0];
|
||||
const hasEmptyFilename = updatedName.trim() === '';
|
||||
const hasOnlyExtension = newFileExtension && updatedName.trim() === newFileExtension[0];
|
||||
if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder) {
|
||||
this.setUpdatedName(currentName);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue