[5.0] Fix base64 encoding - take 2#1888
Conversation
- Use string_view and return vector<char> instead of string
This has the potential to affect downstream usages when |
Good point. I'm not a fan of |
The issue is that if |
For better compatibility, maybe we should add a '\0' at the end of the vector (not included in its |
You mean append a |
libraries/libfc/src/variant.cpp
Outdated
| // fc version of base64_decode allows for extra `=` at the end of the string. | ||
| // Other base64 decoders will not accept the extra `=`. | ||
| std::vector<char> b64 = base64_decode( str ); | ||
| return blob( { std::move(b64) } ); |
There was a problem hiding this comment.
Very minor detail
| return blob( { std::move(b64) } ); | |
| return { std::move(b64) }; |
#1482 fixed base64 encoding by removing the unneeded extra
=that variant added to base64 encoded data. However, it also updated the base64 library with a stricter one. This PR leaves the old base64 encoding/decoding library but does remove the extra=from the base64 encoded data so non-fc base64 decoders will not claim the data is invalid.This change still breaks backward compatibility with 3.2 & 4.0
cleos/nodeos. PRs to 3.2 (#1889) and (#1892) 4.0 will be created that will allow them to work with this new base64 encoding (they will no longer expect the invalid=character).PR #1886 reverts #1482. This PR provided an alternative fix for #1461.
Included in this PR is an optimization to the existing
base64_decodeto avoid a copy for our use-cases by returning avector<char>instead of astring.Included in this PR is a change to the
nodeos_run_test.pyto keep thekeosdrunning with passed--leaving-runningwhich is useful for local testing. This was used to manually test using 3.2cleoswith 5.0.Resolves #1461