forked from syndicate-lang/preserves
Tweak base64 variant handling
This commit is contained in:
parent
5fa8c32ba0
commit
9b100ab9aa
|
@ -287,10 +287,12 @@
|
||||||
(define ch (next-char))
|
(define ch (next-char))
|
||||||
(cond [(eqv? ch #\])
|
(cond [(eqv? ch #\])
|
||||||
(base64-decode (string->bytes/latin-1 (list->string (reverse acc))))]
|
(base64-decode (string->bytes/latin-1 (list->string (reverse acc))))]
|
||||||
|
[(char=? ch #\-) (read-base64-binary (cons #\+ acc))]
|
||||||
|
[(char=? ch #\_) (read-base64-binary (cons #\/ acc))]
|
||||||
[(or (and (char>=? ch #\A) (char<=? ch #\Z))
|
[(or (and (char>=? ch #\A) (char<=? ch #\Z))
|
||||||
(and (char>=? ch #\a) (char<=? ch #\z))
|
(and (char>=? ch #\a) (char<=? ch #\z))
|
||||||
(and (char>=? ch #\0) (char<=? ch #\9))
|
(and (char>=? ch #\0) (char<=? ch #\9))
|
||||||
(memv ch '(#\+ #\/ #\- #\_ #\=)))
|
(memv ch '(#\+ #\/ #\=)))
|
||||||
(read-base64-binary (cons ch acc))]
|
(read-base64-binary (cons ch acc))]
|
||||||
[else
|
[else
|
||||||
(parse-error "Invalid base64 character")]))
|
(parse-error "Invalid base64 character")]))
|
||||||
|
|
Loading…
Reference in New Issue