How to use the @jupyterlab/docmanager.isValidFileName function in @jupyterlab/docmanager

To help you get started, we’ve selected a few @jupyterlab/docmanager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / packages / filebrowser / src / listing.ts View on Github external
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.');
      }
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / filebrowser / src / listing.ts View on Github external
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.');
      }