-
-
Notifications
You must be signed in to change notification settings - Fork 356
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(yaml): properly escape double quotes #3965
Conversation
Does Companion also need a similar fix? |
I must admit I didn’t try. Chances are that we don’t, as the YAML lib is probably already doing the right thing. |
I tried this PR on my TX16S. If I add a '"' to a model name on the radio it works. However if I then load the radio/model settings into Companion and try and run the simulator it crashes. Companion converts the \x22 string back to a '"' character - so the escaping is lost. |
Also Companion does not currently allow entering '"' characters into the model name. If this is going to be allowed on the radio is should probably also be allowed in Companion. |
Absolutely. That means we need to dig into the YAML lib and find out how we can have proper escaping. |
Brute force solution for Companion. Force ALL output to be double quoted (and I really mean ALL).
|
Would make sense, right? There might be some implications with the ZIP compression as well. |
Instead of trying to hack the yaml-cpp output (which is technically correct), I've pushed a change so that the firmware can correctly read back the strings saved in Companion that contain embedded double quotes. Also changed Companion to allow the '"' character in model names. |
@philmoz If I understand it correctly, your change would effect the following: On the radio side:
On the companion side:
|
On the radio strings are always enclosed in double quotes. On Companion strings are not enclosed in double quotes unless they contain special characters (as per the YAML spec). The latest change modifies the radio YAML reader to handle the case where a string is not enclosed in quotes; but contains an embedded quote. |
Thx @philmoz! Would you mind adding some unit test? 😅 |
…ed quote. Allow '"' in model name in Companion.
7d419ae
to
9b5339c
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.
Working good on TX16S and TX12MK2, both on radio (not longer mangling model) and when syncing with Companion.
Two aspects that could be improved on B&W - you can't select double quote as a input character - I think this may be raised in an older issue regarding order and punctuation, but come to light again now. And secondly, while the quote is visible for smaller font, it's not visble in the larger font that displays the model name (on 128x64, at least).
hey, i have the same issue, i want to name my model 5" quad but it just erases all the data on that model after a reboot (tx16s) and im on the newest version of edge tx, is there a way to fix this? |
Summary of changes:
"
inside string elements