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

Handle aliases in path2uid #1848

Merged
merged 7 commits into from
Dec 17, 2024
Merged

Handle aliases in path2uid #1848

merged 7 commits into from
Dec 17, 2024

Conversation

cekk
Copy link
Member

@cekk cekk commented Nov 26, 2024

It's me..again ;)

This time, my edge-case is:

I have a parent Document (/aaa) with some contents inside it (/aaa/foo).
The parent have some text with an internal link to /aaa/foo that is stored in block data as a resolveuid string (correct).
Now, edit parent changing its id (from "aaa" to "bbb") and add some random text.
When you save the form, Volto sends to restapi the blocks with the link to foo like this: http://localhost:3000/aaa/foo.
restapi deserializer now try to resolve all links and convert them in resolveuid-like, but it is called after parent rename, so the path "/aaa/foo" is invalid and lead to store in the parent blocks a link like "http://localhost:3000/aaa/foo" that is potentially broken.

My pr add an additional check in path2uid method, to check also aliases for a given path.


📚 Documentation preview 📚: https://plonerestapi--1848.org.readthedocs.build/

@cekk cekk requested a review from davisagli November 26, 2024 14:57
@mister-roboto
Copy link

@cekk thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@cekk
Copy link
Member Author

cekk commented Nov 26, 2024

@jenkins-plone-org please run jobs

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

@cekk That's quite a nasty edge case, and a clever solution. Thanks.

@davisagli davisagli merged commit a571899 into main Dec 17, 2024
21 of 25 checks passed
@davisagli davisagli deleted the cekk_path2uid_handle_aliases branch December 17, 2024 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants