summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-09-20 00:05:41 +0200
committerAndreas Rumpf <rumpf_a@web.de>2020-09-20 00:05:41 +0200
commitcbdda631dbd68765203d1843f217f47c6e0c5c48 (patch)
tree9261bbb955d472c30c7e09c44834f2b08bf420e2
parent9a34009f00749bb29f3c58256648994940533e06 (diff)
downloadNim-cbdda631dbd68765203d1843f217f47c6e0c5c48.tar.gz
base64: fixes the error message for an invalid base64 input character [backport:1.2]
-rw-r--r--lib/pure/base64.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim
index 9495c4d56..40c9af905 100644
--- a/lib/pure/base64.nim
+++ b/lib/pure/base64.nim
@@ -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)