Skip to content

Use local paths instead of driveName:path in the shared model#13866

Merged
fcollonval merged 1 commit into
jupyterlab:masterfrom
hbcarlos:fix_context_path
Jan 27, 2023
Merged

Use local paths instead of driveName:path in the shared model#13866
fcollonval merged 1 commit into
jupyterlab:masterfrom
hbcarlos:fix_context_path

Conversation

@hbcarlos

Copy link
Copy Markdown
Member

JupyterLab prefixes every path with the name of the drive (like driveName:foo/bar.txt). When we make a call to the contents manager, this one is responsible for removing the name of the drive from the path, making the request through the corresponding drive, and adding the name of the drive back to each path present in the response.

To be able to rename files in a collaborative session, we added the path of the document to the shared model. At the moment, this path is used by the backend (jupyter_server_ydoc) to track whether the file was renamed or not.

Since the path is used by the backend and it doesn't know about drives, the context has the same responsibility as the contents manager (removing/adding the name of the drive into the path every time it writes/reads the path from the shared model).

References

Code changes

Transforms the path every time the context writes/reads from the shared model.

User-facing changes

Fixes a bug when restoring a document in collaborative mode

Backwards-incompatible changes

N/A

cc @fcollonval

@hbcarlos hbcarlos added the bug label Jan 26, 2023
@hbcarlos hbcarlos added this to the 4.0.0 milestone Jan 26, 2023
@hbcarlos hbcarlos requested a review from fcollonval January 26, 2023 16:21
@hbcarlos hbcarlos self-assigned this Jan 26, 2023
@jupyterlab-probot

Copy link
Copy Markdown

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

Comment thread packages/docregistry/src/context.ts

@fcollonval fcollonval left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @hbcarlos

@fcollonval fcollonval merged commit e2c629e into jupyterlab:master Jan 27, 2023
@hbcarlos hbcarlos deleted the fix_context_path branch January 27, 2023 11:15
@hbcarlos

hbcarlos commented Mar 2, 2023

Copy link
Copy Markdown
Member Author

@meeseeksdev please backport to 3.6.x

meeseeksmachine pushed a commit to meeseeksmachine/jupyterlab that referenced this pull request Mar 2, 2023
fcollonval pushed a commit that referenced this pull request Mar 6, 2023
…shared model (#14111)

Co-authored-by: Carlos Herrero <contact@carloshb.com>
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants