Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility function resolveUrl on manager #1993

Merged
merged 1 commit into from Mar 16, 2018

Conversation

vidartf
Copy link
Member

@vidartf vidartf commented Mar 8, 2018

This is needed to be able to resolve file URLs relative to the widget's notebook.

Example: My widget needs to load an image at the path 'img/earth.jpg'. This is implied to be relative to the path of the current notebook (I cannot see a case where this wouldn't be what the user would expect, but I'm sure someone will come along at some point). In classic notebook, this works out of the box, since the url always incorporates the location of the notebook. For jupyter lab, this is not the case. By adding a utility function on the widget manger, we add a frontend-agnostic way of resolving the URL.

This is needed to be able to resolve file URLs relative to the widget's
notebook.
@SylvainCorlay
Copy link
Member

Thanks @vidartf. This should solve https://github.com/ellisonbg/ipyleaflet/issues/120, which is exactly what you described.

@maartenbreddels
Copy link
Member

@astrofrog I think you also needed this a while back, and I gave you a dirty hack for it, this looks much cleaner

@vidartf vidartf requested a review from jasongrout March 14, 2018 13:29
@jasongrout
Copy link
Member

Thanks!

@jasongrout jasongrout merged commit 45f2c3b into jupyter-widgets:master Mar 16, 2018
@jasongrout jasongrout added this to the Minor release milestone Mar 16, 2018
@vidartf vidartf deleted the resolveurl branch March 16, 2018 08:46
@jasongrout jasongrout modified the milestones: Minor release, 7.2 Mar 19, 2018
@vidartf
Copy link
Member Author

vidartf commented Apr 3, 2018

Should this have been using getDownloadUrl instead of resolveUrl on UrlResolver?

@vidartf
Copy link
Member Author

vidartf commented Apr 3, 2018

Or rather, in addition to.

@vidartf
Copy link
Member Author

vidartf commented Apr 3, 2018

Mainly to be future proof in case anybody adds another Drive with an overridden getDownloadUrl.

@jasongrout
Copy link
Member

Good question. Can you open another issue so we can discuss, and possibly target to a 7.2.1?

@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label May 21, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement pkg:base pkg:jupyterlab resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants