Fix mistakenly adding “./” when uri->string’ing

This is due to weird/mistakenly input URLs…
like Matrix ones, which uri-common doesn’t like.
¯\_(ツ)_/¯
This commit is contained in:
Jaidyn Ann 2024-02-18 21:46:55 -06:00
parent 58f6fd70b8
commit 099e74cc38

View File

@ -69,6 +69,7 @@
(uri:uri-reference string)) (uri:uri-reference string))
;; Parse a data URIs contents into a list containing the mimetype (string) ;; Parse a data URIs contents into a list containing the mimetype (string)
;; and bytevector contents (u8vector). ;; and bytevector contents (u8vector).
;; "data:text/plain;base64,ZGFk" → ("text/plain;base64" #u8(100 97 100)) ;; "data:text/plain;base64,ZGFk" → ("text/plain;base64" #u8(100 97 100))
@ -123,7 +124,10 @@
;; string-form… as best we can. ;; string-form… as best we can.
(define (serialize-uri-prop-value value) (define (serialize-uri-prop-value value)
(cond [(uri:uri? value) (cond [(uri:uri? value)
(uri:uri->string value)] (irregex-replace
":./"
(uri:uri->string value)
":")] ;; Some URIs have “./” mistakenly prepended.
[(list? value) [(list? value)
(bytevector->data-uri-str (car value) (cadr value))] (bytevector->data-uri-str (car value) (cadr value))]
[(string? value) [(string? value)