-
Notifications
You must be signed in to change notification settings - Fork 276
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
[WIP] Contents: avoid double-URIdecoding paths #1216
base: main
Are you sure you want to change the base?
[WIP] Contents: avoid double-URIdecoding paths #1216
Conversation
917e246
to
07003ed
Compare
07003ed
to
3d90d8e
Compare
My coworker and I started on a ui-test for this, a new test which ran through "Open from URL", which is where I first saw the problem in #1211 Now that the fix is ready, the bug seems larger in scope than just opening from URLs. For example, dragging a file named |
still some weirdness on this branch! so very much a wip, which I have now marked example of some remaining weirdness:
|
ui-tests/test/contents.test.ts
Outdated
@@ -22,7 +22,7 @@ test.use({ | |||
waitForApplication: firefoxWaitForApplication, | |||
}); | |||
|
|||
test.describe('Contents Tests', () => { | |||
test.describe.only('Contents Tests', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use the -g
Playwright command line option to only run a subset of the test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! nice tip
Hello! We're working on a jupyterlite integration over at https://prospective.co. I'm thrilled to contribute a bug fix back to jupyterlite! 🎉
References
Addresses #1211
Code changes
The paths coming in to /api/contents need to be URI decoded, because jupyterlab's frontend URI encodes them.
The existing Contents API would sometimes double-decode the filenames. For example,
Contents.createCheckpoint()
would decode the path once, then callthis.get()
on the path, which would decode it again.To prevent double-decoding, the URI decode is moved out of the Contents class and into the route definitions.
User-facing changes
Users can now add both files from URLs containing percent-encoded characters, and files from their filesystem with names like
hello%20world.txt
.Backwards-incompatible changes
This has a side effect of changing the Contents class API to accept "regular" paths, and not URI-encoded ones. For example,
Contents.get("hello%20world.txt")
will now return a file namedhello%20world.txt
on the filesystem, instead of a file namedhello world.txt
.