Skip to content

Commit 80f5c7a

Browse files
authored
Add a uploadpath query param to upload the repo to
1 parent 559956e commit 80f5c7a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ const gitPullerExtension: JupyterFrontEndPlugin<void> = {
6161

6262
let puller: GitPuller | null = null;
6363

64-
const basePath = PathExt.basename(repo);
6564
const branch = urlParams.get('branch') || 'main';
6665
const provider = urlParams.get('provider') || 'github';
6766
const filePath = urlParams.get('urlpath');
67+
const uploadPath = urlParams.get('uploadpath') | '/';
68+
69+
const basePath = PathExt.join(uploadPath, PathExt.basename(repo));
6870

6971
const repoUrl = new URL(repo);
7072
if (provider === 'github') {
@@ -95,10 +97,10 @@ const gitPullerExtension: JupyterFrontEndPlugin<void> = {
9597
return;
9698
}
9799

98-
puller.clone(repoUrl.href, branch, basePath).then(async basePath => {
100+
puller.clone(repoUrl.href, branch, basePath).then(async repoPath => {
99101
if (filePath) {
100102
app.commands.execute('filebrowser:open-path', {
101-
path: PathExt.join(basePath, filePath)
103+
path: PathExt.join(repoPath, filePath)
102104
});
103105
}
104106
});

0 commit comments

Comments
 (0)