mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
base64: fixes the error message for an invalid base64 input character [backport:1.2]
This commit is contained in:
@@ -230,11 +230,11 @@ proc decode*(s: string): string =
|
||||
|
||||
template inputChar(x: untyped) =
|
||||
let x = int decodeTable[ord(s[inputIndex])]
|
||||
inc inputIndex
|
||||
if x == invalidChar:
|
||||
raise newException(ValueError,
|
||||
"Invalid base64 format character `" & s[inputIndex] &
|
||||
"` (ord " & $s[inputIndex].ord & ") at location " & $inputIndex & ".")
|
||||
inc inputIndex
|
||||
|
||||
template outputChar(x: untyped) =
|
||||
result[outputIndex] = char(x and 255)
|
||||
|
||||
Reference in New Issue
Block a user