-
Notifications
You must be signed in to change notification settings - Fork 523
add handling for non-utf 8 asset names #2555
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
add handling for non-utf 8 asset names #2555
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2555 +/- ##
==========================================
+ Coverage 46.89% 46.94% +0.04%
==========================================
Files 346 348 +2
Lines 55616 55668 +52
==========================================
+ Hits 26081 26132 +51
- Misses 26580 26590 +10
+ Partials 2955 2946 -9
Continue to review full report at Codecov.
|
| UnitName: strOrNil(params.UnitName), | ||
| Url: strOrNil(params.URL), | ||
| Name: strOrNil(sanitizePrintableUTF8String(params.AssetName)), | ||
| NameB64: strOrNil(base64.StdEncoding.EncodeToString([]byte(params.AssetName))), |
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.
I thought we were only going to return one copy. Plain if valid, b64 otherwise.
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.
No - we're storing one copy, but returning (sometimes) both, so that clients that use b64 could always decode that and could ignore the non-b64 version.
winder
left a comment
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.
Updates LGTM
algonautshant
left a comment
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.
Looks great.
Summary
The asset parameter fields name, unit name and url might contain non-utf 8 printable characters. This PR modifies the
REST API so that the existing field would only be returned in case the entire string is a utf-8 printable string. To complement that, a _b64 version of the field would be provided, allowing the client to support non-printable strings.
Test Plan
Use existing unit tests.