base64Decode: clearer error message when an invalid character is detected

Output the offending string in its entirety to provide context.

Closes #8479
This commit is contained in:
Brian McGee 2023-07-31 18:40:45 +01:00
parent dcdd5fed74
commit dc3ccf02bf
No known key found for this signature in database
GPG key ID: D49016E76AD1E8C0

View file

@ -1618,8 +1618,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;