Skip to content

Commit bf76045

Browse files
committed
Fix github button for orgs
1 parent 31c8163 commit bf76045

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/browser.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ class GitHubFileBrowser extends Widget {
4848
const user = this._drive.user;
4949
const path = this._browser.model.path;
5050
const repo = path.split('/')[0].split(':')[1];
51-
const repoPath = URLExt.join(...path.split('/').slice(1));
52-
const url = URLExt.join(GITHUB_BASE_URL, user, repo,
53-
'tree', 'master', repoPath);
51+
let url = URLExt.join(GITHUB_BASE_URL, user);
52+
if (repo) {
53+
const dirPath = URLExt.join(repo, ...path.split('/').slice(1));
54+
url = URLExt.join(url, repo, 'tree', 'master', dirPath);
55+
}
5456
window.open(url);
5557
},
5658
className: 'jp-GitHubIcon',

0 commit comments

Comments
 (0)