(zilch magic): fix off-by-one when replacing the end of the string

This commit is contained in:
puck 2025-06-23 12:22:20 +00:00
parent 6e4d191145
commit 99bb2501e3

View file

@ -282,7 +282,7 @@
(define parts '())
(let find-part-at ((i 0) (last-i 0))
(let ((next-slash (bytestring-index str (lambda (c) (= c #x2F)) i)))
(if (or (not next-slash) (>= next-slash (- (bytevector-length str) 53)))
(if (or (not next-slash) (> next-slash (- (bytevector-length str) 53)))
(if (= last-i 0)
(set! parts #f)
(set! parts (cons (bytevector-copy str last-i) parts)))