-
Notifications
You must be signed in to change notification settings - Fork 352
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
Parse JSON blobs more leniently #5502
Conversation
Specifically: * Ignore trailing commas in objects and arrays * Add missing outer braces, if missing * Ignore "comment" lines, i.e. lines beginning with '#' * If a value is expected to be an array but isn't, wrap it in an array
18c226c
to
8e6ccb9
Compare
DES-478 Parse settings patches less strictly
|
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dlon)
mullvad-daemon/src/settings/patch.rs
line 206 at r2 (raw file):
.filter(|line| !line.trim_start().starts_with('#')) .collect::<Vec<_>>() .join("\n");
This should be refactored to it's own function, and combining multiple transformations be done via composition / chaining function calls instead 😊
Code quote:
// Remove commented lines
let mut patch = json_patch
.lines()
.filter(|line| !line.trim_start().starts_with('#'))
.collect::<Vec<_>>()
.join("\n");
8ffba1a
to
32221f6
Compare
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)
mullvad-daemon/src/settings/patch.rs
line 206 at r2 (raw file):
Previously, MarkusPettersson98 (Markus Pettersson) wrote…
This should be refactored to it's own function, and combining multiple transformations be done via composition / chaining function calls instead 😊
Done.
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
Specifically:
As an example, this is now valid:
The above is equivalent to
Fix DES-478.
This change is