Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/3.2' into AntelopeIOGH-1461
Browse files Browse the repository at this point in the history
-base64-4.0
  • Loading branch information
heifner committed Nov 13, 2023
2 parents dd4217f + 8a9d841 commit 78181c4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libraries/libfc/src/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,14 @@ blob variant::as_blob()const
{
const string& str = get_string();
if( str.size() == 0 ) return blob();
if( str.back() == '=' )
{
std::string b64 = base64_decode( get_string() );
try {
// variant adds `=` to end of base64 encoded string (see as_string() above) which produces invalid base64
// variant in 5.0 no longer appends the '=' character to conform to valid base64 encoding
// fc version of base64_decode allows for extra `=` at the end of the string
std::string b64 = base64_decode( str );
return blob( { std::vector<char>( b64.begin(), b64.end() ) } );
} catch(const std::exception&) {
// unable to decode, return raw chars
}
return blob( { std::vector<char>( str.begin(), str.end() ) } );
}
Expand Down

0 comments on commit 78181c4

Please sign in to comment.