mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
base64Decode: clearer error message when an invalid character is detected
Output the offending string in its entirety to provide context.
Closes #8479
(cherry picked from commit dc3ccf02bf
)
This commit is contained in:
parent
e873d00bda
commit
9d34c6429b
|
@ -260,8 +260,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;
|
||||
|
|
Loading…
Reference in a new issue