From 02749cb1dcad0b221fd9e83d01ff5bb66a637ea0 Mon Sep 17 00:00:00 2001 From: Ben Kircher Date: Mon, 9 Feb 2026 09:21:01 +0100 Subject: [PATCH] url: fix comma handling This string foo/bar,baz.txt should not match but src/foo.c,baz.txt should. Remove `,` from dotted_path_lookahead and non_dotted_path_lookahead. --- src/config/url.zig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config/url.zig b/src/config/url.zig index 47541f096..dd9ae94ad 100644 --- a/src/config/url.zig +++ b/src/config/url.zig @@ -53,11 +53,11 @@ const trailing_spaces_at_eol = ; const dotted_path_lookahead = - \\(?=[\w\-.~:\/?#@!$&*+,;=%]*\.) + \\(?=[\w\-.~:\/?#@!$&*+;=%]*\.) ; const non_dotted_path_lookahead = - \\(?![\w\-.~:\/?#@!$&*+,;=%]*\.) + \\(?![\w\-.~:\/?#@!$&*+;=%]*\.) ; const dotted_path_space_segments = @@ -369,6 +369,11 @@ test "url regex" { .input = "some-pkg/src/file.txt more text", .expect = "some-pkg/src/file.txt", }, + // comma should match substrings + .{ + .input = "src/foo.c,baz.txt", + .expect = "src/foo.c", + }, .{ .input = "~/foo/bar.txt", .expect = "~/foo/bar.txt", @@ -452,6 +457,8 @@ test "url regex" { "$10/bar", "$10/$20", "$10/bar.txt", + // comma should not let dot detection look past it + "foo/bar,baz.txt", }; for (no_match_cases) |input| { var result = re.search(input, .{});