add handling for non-utf 8 asset names#2555
Merged
tsachiherman merged 6 commits intoJul 16, 2021
Merged
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.
|
winder
reviewed
Jul 15, 2021
winder
reviewed
Jul 15, 2021
brianolson
reviewed
Jul 15, 2021
| UnitName: strOrNil(params.UnitName), | ||
| Url: strOrNil(params.URL), | ||
| Name: strOrNil(sanitizePrintableUTF8String(params.AssetName)), | ||
| NameB64: strOrNil(base64.StdEncoding.EncodeToString([]byte(params.AssetName))), |
Contributor
There was a problem hiding this comment.
I thought we were only going to return one copy. Plain if valid, b64 otherwise.
Contributor
Author
There was a problem hiding this comment.
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
approved these changes
Jul 15, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.