-
Notifications
You must be signed in to change notification settings - Fork 67
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
Sanitize manufacturer name to avoid json errors. #1235
Sanitize manufacturer name to avoid json errors. #1235
Conversation
9393030
to
5a2ad78
Compare
5a2ad78
to
837c1c6
Compare
837c1c6
to
1b4aa4c
Compare
maybe it would make even more sense to add string validation to |
imho it makes sense to do the cleanup when we set the manufacturer string because it always makes sense to fix issues at the source of the problem and we should not pass around bad strings |
I agree with Andreas. The new function is not indented properly. I am going to fix this now so this can be merged. |
If the string contains control characters for some reason, the browser will reject the json with the error `bad control character in string literal`. This adds a setManufacturer function that validates the string is ASCII and will cut off the string at the first non-ascii character. Pylontech: `PYLON` (50 59 4C 4F 4E 20 20 20) Pytes: `PYTES` (50 59 54 45 53) Deye: `DY001` (44 59 30 30 31 03 E8 03) See hoylabs#1226 (comment)
1b4aa4c
to
1af5a2c
Compare
Thanks, @ranma 🚀 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns. |
If the string contains control characters for some reason, the browser will reject the json with the error
bad control character in string literal
.See #1226 (comment)