Skip to content

Add fromURLToFolder parameter to define target folder - #29

Merged
krassowski merged 11 commits into
jupyterlab-contrib:mainfrom
MUFFANUJ:addFolderSupport
May 1, 2026
Merged

Add fromURLToFolder parameter to define target folder#29
krassowski merged 11 commits into
jupyterlab-contrib:mainfrom
MUFFANUJ:addFolderSupport

Conversation

@MUFFANUJ

@MUFFANUJ MUFFANUJ commented Apr 30, 2026

Copy link
Copy Markdown
Member

Closes #28

This PR adds a fromURLToFolder query parameter to control where files opened via fromURL are created. When folder is provided, the extension creates missing directories, uploads all requested files into that folder in order, opens them, and restores the previous file-browser directory afterward. It also removes handled query params (fromURL and fromURLToFolder) from the URL after processing and updates the README with the new usage.

@MUFFANUJ MUFFANUJ added the enhancement New feature or request label Apr 30, 2026
@github-actions

Copy link
Copy Markdown

Binder 👈 Launch a Binder on branch MUFFANUJ/jupyterlab-open-url-parameter/addFolderSupport

@krassowski

Copy link
Copy Markdown
Collaborator

Second thought on naming: folder/directory might conflict with query args in other extensions. fromURLToFolder would be a safe bet I suppose. CC @jtpio and @yuvipanda as contributors here in case if you have thoughts.

@MUFFANUJ
MUFFANUJ marked this pull request as ready for review April 30, 2026 16:46
@jtpio

jtpio commented Apr 30, 2026

Copy link
Copy Markdown
Member

Second thought on naming: folder/directory might conflict with query args in other extensions. fromURLToFolder would be a safe bet I suppose

Yes that's always an issue, also something seen in JupyterLite with the REPL query arguments.

Not sure there is a good way to handle this properly except maybe trying to make the argument more unique, like this suggestion.

@jtpio

jtpio commented Apr 30, 2026

Copy link
Copy Markdown
Member

btw feel free to merge and make a new release if you need that change for the plugin playground and JupyterLab.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for uploading and opening fromURL resources into a specified destination folder, with accompanying documentation and CI/docs build environment updates.

Changes:

  • Add fromURLToFolder query parameter handling to upload fromURL files into a target folder (creating directories as needed) and restore the prior filebrowser directory afterward.
  • Remove handled query parameters from the URL after processing (fromURL, fromURLToFolder).
  • Update docs/readme and modernize docs/CI configuration (ReadTheDocs + artifact actions + docs conda env).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/index.ts Implements folder-targeted uploads, directory creation, sequential open behavior, and query param cleanup.
README.md Documents the new fromURLToFolder usage with examples.
docs/environment.yml Updates docs build environment dependencies (JupyterLab/Node/JupyterLite).
.readthedocs.yml Updates ReadTheDocs build image/tooling selectors.
.github/workflows/check-release.yml Bumps artifact upload action version.
.github/workflows/build.yml Bumps artifact upload/download action versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts
@krassowski krassowski changed the title Add folder support for fromURL uploads Add fromURLToFolder parameter to define target folder Apr 30, 2026
@yuvipanda

Copy link
Copy Markdown
Collaborator

I love this feature!

However, note that there are potential security issues here - nbgitpuller faces the same ones, as described in jupyter/docker-stacks#2000. You can construct a link that pulls an arbitrary file into being .bashrc (if it doesn't exist) for example, or similar.

My approach to dealing with this in nbgitpuller was to try to have a setting that lets hub admins who care about it turn that off (we never actually did it though). Perhaps we could do that from the start here?

@krassowski

krassowski commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks for that @yuvipanda, that's a valid concern. Isn't that already possible on main with:

https://jupyterlab-open-url-param.readthedocs.io/en/latest/lite/lab?fromURL=https://gist.githubusercontent.com/rchowe/1727301/raw/c2dd8d45d62ce2a35ed4ccb7bd499597f3391485/.bashrc

Where is the concerning increase in the surface here? The root_dir should guard us against going up on jupyter-server, so I suppose if the root was set to / and one used prefered_dir for user folders then this could potentially allow to place files further down?

@yuvipanda

Copy link
Copy Markdown
Collaborator

Yeah, I realize .bashrc is already the case :) So don't let that concern block you here, but just something to keep in mind.

@krassowski

Copy link
Copy Markdown
Collaborator

@MUFFANUJ

Copy link
Copy Markdown
Member Author

working on fixing this :)

@MUFFANUJ
MUFFANUJ requested a review from krassowski April 30, 2026 20:56

@krassowski krassowski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested across a number of edge-cases, looks good - thank you!

@krassowski
krassowski merged commit 2c6a5b9 into jupyterlab-contrib:main May 1, 2026
6 checks passed
@krassowski

Copy link
Copy Markdown
Collaborator

This is up: https://github.com/jupyterlab-contrib/jupyterlab-open-url-parameter/releases/tag/v0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a folder/directory parameter to specify where the file from URL should be created

5 participants