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 hasExtensionIfFolder = this.props.fileType === 'folder' && hasPeriod;
|
||||||
const notSameExtension = oldFileExtension && newFileExtension
|
const notSameExtension = oldFileExtension && newFileExtension
|
||||||
&& oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase();
|
&& oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase();
|
||||||
const hasEmptyFilename = updatedName === '';
|
const hasEmptyFilename = updatedName.trim() === '';
|
||||||
const hasOnlyExtension = newFileExtension && updatedName === newFileExtension[0];
|
const hasOnlyExtension = newFileExtension && updatedName.trim() === newFileExtension[0];
|
||||||
if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder) {
|
if (hasEmptyFilename || hasNoExtension || notSameExtension || hasOnlyExtension || hasExtensionIfFolder) {
|
||||||
this.setUpdatedName(currentName);
|
this.setUpdatedName(currentName);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue