-
Notifications
You must be signed in to change notification settings - Fork 650
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
Fix slash in path. #3573
base: master
Are you sure you want to change the base?
Fix slash in path. #3573
Conversation
parts = pointer.parts | ||
|
||
# Re-escapes `/` in path parts by converting `/` back to `~1`. | ||
parts = [part.replace("/", "~1") for part in pointer.parts] |
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.
Is it an issue for multi-asic only?
I remember in single asic, the jsonpointer has built in feature to parse / to ~1
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.
It was introduced by multi asic change, we have to extract the namespace from the patch, then JsonPointer will do escape ~1
back to /
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.
Sorry. I don't get it.
By the code here, the extract_scope doesn't differentiate single or multi. How do we guarantee single asic is not broken?
sonic-utilities/config/main.py
Lines 1599 to 1600 in 319f58d
for change in patch: | |
scope, modified_path = extract_scope(change["path"]) |
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.
For single asic, the portchannel interface does not have slash in port, but multi asic does have, hence, we could do escape slash to ~1 in jsonpatch.
What I did
Addressing issue #3444. The issue caused by unescape in JsonPointer implementation which followed RFC 6901
How I did it
Re-escape
/
to~1
to match the real key in json, and JsonPatch will handle it correctly.How to verify it
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)