Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Private.doRename(nameNode, this._editNode).then(newName => {
this.node.focus();
if (!newName || newName === original) {
this._inRename = false;
return original;
}
if (!isValidFileName(newName)) {
void showErrorMessage(
'Rename Error',
Error(
`"${newName}" is not a valid name for a file. ` +
`Names must have nonzero length, ` +
`and cannot include "/", "\\", or ":"`
)
);
this._inRename = false;
return original;
}
if (this.isDisposed) {
this._inRename = false;
throw new Error('File browser is disposed.');
}
return Private.doRename(nameNode, this._editNode).then(newName => {
if (!newName || newName === original) {
this._inRename = false;
return original;
}
if (!isValidFileName(newName)) {
showErrorMessage(
'Rename Error',
Error(
`"${newName}" is not a valid name for a file. ` +
`Names must have nonzero length, ` +
`and cannot include "/", "\\", or ":"`
)
);
this._inRename = false;
return original;
}
if (this.isDisposed) {
this._inRename = false;
throw new Error('File browser is disposed.');
}