-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Improve the block transforms to include also anchors when resolving uid back and forth #1746
Conversation
…id back and forth
✅ Deploy Preview for plone-restapi canceled.
|
@sneridagh thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
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! |
@jenkins-plone-org please run jobs |
I know, it’s one or the other, never both. Do you have a use case in mind?
Víctor Fernández de Alba
Github/Twitter: sneridagh
…On Wed, 31 Jan 2024 at 20:37, David Glick ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In src/plone/restapi/deserializer/utils.py
<#1746 (comment)>:
> @@ -25,11 +25,13 @@ def path2uid(context, link):
)
# handle edge-case when we have non traversable path like /@@download/file
- if "/@@" in path:
- path, suffix = path.split("/@@", 1)
- suffix = "/@@" + suffix
- else:
- suffix = ""
+ SUFFIXES = ["/@@", "#"]
+ suffix = ""
+ for suffix_separator in SUFFIXES:
+ if suffix_separator in path:
+ path, suffix = path.split(suffix_separator, 1)
@sneridagh <https://github.com/sneridagh> You are overwriting suffix
here. So if both separators are present, only one of the suffixes will be
kept.
------------------------------
In src/plone/restapi/serializer/utils.py
<#1746 (comment)>:
> @@ -23,13 +23,15 @@ def resolve_uid(path):
if match is None:
return path, None
- uid, suffix = match.groups()
+ uid, suffix, anchor = match.groups()
brain = uuidToCatalogBrain(uid)
if brain is None:
return path, None
href = brain.getURL()
if suffix:
return href + "/" + suffix, brain
What if there is a suffix and an anchor?
—
Reply to this email directly, view it on GitHub
<#1746 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADW4D3TZMLO7PPU4CO3EILYRKMOPAVCNFSM6AAAAABCQ2L5ECVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNJUGY3TKNZVGI>
.
You are receiving this because you were mentioned.Message ID: <plone/plone
.***@***.***>
|
@davisagli I think not, because a suffix is something that matches a |
@sneridagh Although this is plone.restapi, the URLs that an editor can enter are not API URLs. It could be a browser view that renders HTML including anchors, sure. Here we need to be careful and pass through unchanged anything that is not the path to a content item. |
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.
Uh, the tests are failing...
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.
Okay, let's see what jenkins says...
@jenkins-plone-org please run jobs |
Now it covers the use case if an anchor is present.