Skip to content

Commit 182563d

Browse files
committed
Use new path parsing.
1 parent a4bc663 commit 182563d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/browser.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ class GitHubFileBrowser extends Widget {
7575
window.open(url);
7676
return;
7777
}
78-
const resource = parsePath(this._browser.model.path.split(':')[1]);
78+
const localPath = this._browser.model.manager.services.contents
79+
.localPath(this._browser.model.path);
80+
const resource = parsePath(localPath);
7981
url = URLExt.join(url, resource.user);
8082
if (resource.repository) {
8183
url = URLExt.join(url, resource.repository,
@@ -95,7 +97,9 @@ class GitHubFileBrowser extends Widget {
9597
if (!this._binderActive) {
9698
return;
9799
}
98-
const resource = parsePath(this._browser.model.path.split(':')[1]);
100+
const localPath = this._browser.model.manager.services.contents
101+
.localPath(this._browser.model.path);
102+
const resource = parsePath(localPath);
99103
const url = URLExt.join(MY_BINDER_BASE_URL, resource.user,
100104
resource.repository, 'master');
101105
window.open(url + '?urlpath=lab');
@@ -144,7 +148,9 @@ class GitHubFileBrowser extends Widget {
144148
* React to the path changing for the browser.
145149
*/
146150
private _onPathChanged(): void {
147-
const resource = parsePath(this._browser.model.path.split(':')[1]);
151+
const localPath = this._browser.model.manager.services.contents
152+
.localPath(this._browser.model.path);
153+
const resource = parsePath(localPath);
148154

149155
// If we are not already changing the user name, set it.
150156
if (!this._changeGuard) {
@@ -186,7 +192,9 @@ class GitHubFileBrowser extends Widget {
186192
* React to a change in the validity of the drive.
187193
*/
188194
private _updateErrorPanel(): void {
189-
const resource = parsePath(this._browser.model.path.split(':')[1]);
195+
const localPath = this._browser.model.manager.services.contents
196+
.localPath(this._browser.model.path);
197+
const resource = parsePath(localPath);
190198
const rateLimited = this._drive.rateLimitedState.get();
191199
const validUser = this._drive.validUser;
192200

0 commit comments

Comments
 (0)