1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

Merge pull request #8766 from brianmcgee/fix/base64-decode-error-message

base64Decode: clearer error message when an invalid character is detected
This commit is contained in:
John Ericson 2024-09-17 09:59:15 -04:00 committed by GitHub
commit 95f2b2beab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -243,8 +243,9 @@ std::string base64Decode(std::string_view s)
if (c == '\n') continue;
char digit = base64DecodeChars[(unsigned char) c];
if (digit == npos)
throw Error("invalid character in Base64 string: '%c'", c);
if (digit == npos) {
throw Error("invalid character in Base64 string: '%c' in '%s'", c, s.data());
}
bits += 6;
d = d << 6 | digit;