Skip to content

Commit 7887ecc

Browse files
committed
Fix user handling in uri parser.
Closes #1065 string-find-right returns the cursor to the right of the match
1 parent 34c0347 commit 7887ecc

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/chibi/uri-test.sld

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@
4444
(test "q=cats" (uri-query (string->uri str)))
4545
(test "recent" (uri-fragment (string->uri str))))
4646

47+
(let ((str "ssh://git@codeberg.org/retropikzel/snow-chibi-testing.git"))
48+
(test-assert (uri? (string->uri str)))
49+
(test 'ssh (uri-scheme (string->uri str)))
50+
(test "git" (uri-user (string->uri str)))
51+
(test "codeberg.org" (uri-host (string->uri str)))
52+
(test #f (uri-port (string->uri str)))
53+
(test "/retropikzel/snow-chibi-testing.git"
54+
(uri-path (string->uri str)))
55+
(test #f (uri-query (string->uri str)))
56+
(test #f (uri-fragment (string->uri str))))
57+
4758
(test "/%73" (uri-path (string->uri "http://google.com/%73")))
4859
(test "/s" (uri-path (string->uri "http://google.com/%73" #t)))
4960
(test "a=1&b=2;c=3"

lib/chibi/uri.scm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@
151151
(%make-uri
152152
scheme
153153
(and (string-cursor>? at sc2)
154-
(decode (substring-cursor str sc2 at)))
154+
(decode
155+
(substring-cursor str sc2 (string-cursor-prev str at))))
155156
(decode
156157
(substring-cursor
157158
str
158-
(if (string-cursor>? at sc2) (string-cursor-next str at) sc2)
159+
(if (string-cursor>? at sc2) at sc2)
159160
(if (string-cursor<? colon3 slash)
160161
colon3
161162
slash)))

0 commit comments

Comments
 (0)