Pārlūkot izejas kodu

Fix handling of missing directory

Steven Silvester 7 gadi atpakaļ
vecāks
revīzija
7bf59e2b20

+ 5 - 1
packages/filebrowser/src/browser.ts

@@ -270,7 +270,11 @@ class FileBrowser extends Widget {
       return;
     }
     this._showingError = true;
-    showErrorMessage('Server Connection Error', args).then(() => {
+    let title = 'Server Connection Error';
+    if (args.message.indexOf('Directory not found') === 0) {
+      title = 'Directory not found';
+    }
+    showErrorMessage(title, args).then(() => {
       this._showingError = false;
     });
   }

+ 2 - 6
packages/filebrowser/src/model.ts

@@ -227,13 +227,9 @@ class FileBrowserModel implements IDisposable {
     }).catch(error => {
       this._pendingPath = null;
       if (error.message === 'Not Found') {
-        let path = this._model.path;
-        error.message = `Directory not found: "${path}"`;
+        error.message = `Directory not found: "${this._model.path}"`;
         this._connectionFailure.emit(error);
-        let parent = PathExt.dirname(path);
-        if (parent !== path) {
-          this.cd('..');
-        }
+        this.cd('/');
       }
     });
     return this._pending;