Skip to content

Commit

Permalink
Check for and remove "RTC:" prefix added by the jupyter-collaboration…
Browse files Browse the repository at this point in the history
… from the file path
  • Loading branch information
andrii-i committed Aug 28, 2024
1 parent 1a775c2 commit f36faa5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,19 @@ function getSelectedFileBaseName(widget: FileBrowser | null): string | null {
}

// Get the file name, with all parent directories, of the currently selected file.
function getSelectedFilePath(widget: FileBrowser | null): string | null {
function getSelectedFilePath(
widget: FileBrowser | null,
app: JupyterFrontEnd<JupyterFrontEnd.IShell, 'desktop' | 'mobile'>
): string | null {
const selectedItem = getSelectedItem(widget);
if (selectedItem === null) {
return null;
}

if (app.serviceManager.contents.driveName(selectedItem.path) === 'RTC') {
return app.serviceManager.contents.localPath(selectedItem.path);
}

return selectedItem.path;
}

Expand Down Expand Up @@ -260,7 +268,8 @@ function activatePlugin(
execute: async () => {
eventLogger('file-browser.create-job');
const widget = fileBrowserTracker.currentWidget;
const filePath = getSelectedFilePath(widget) ?? '';
const filePath = getSelectedFilePath(widget, app) ?? '';
console.log(filePath);

// Update the job form inside the notebook jobs widget
const newCreateModel = emptyCreateJobModel();
Expand Down

0 comments on commit f36faa5

Please sign in to comment.