From c5488afc75a9f9bd2e4c6b718e7828925b276f4a Mon Sep 17 00:00:00 2001 From: Ben Kircher Date: Mon, 16 Feb 2026 07:05:12 +0100 Subject: [PATCH 1/2] url: improve space in path handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The space-segment patterns in the path regex (dotted_path_space_segments and any_path_space_segments) greedily consume text after a space even when we know that the text is the start of a new independent path (e.g., `/tmp/bar` in `/tmp/foo /tmp/bar`). Fix: Add two negative lookaheads after the space in both patterns: - `(?!\.{0,2}\/)` → don't match if the next segment starts with `/`, `./`, or `../` - `(?!~\/)` → don't match if the next segment starts with `~/` --- src/config/url.zig | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/config/url.zig b/src/config/url.zig index da0892a91..359724501 100644 --- a/src/config/url.zig +++ b/src/config/url.zig @@ -65,11 +65,11 @@ const non_dotted_path_lookahead = ; const dotted_path_space_segments = - \\(?:(? Date: Thu, 19 Feb 2026 21:01:24 +0100 Subject: [PATCH 2/2] url: fix regression with unified diff lines Bare relative paths don't need space-continuation semantics. Fixes #10773 --- src/config/url.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config/url.zig b/src/config/url.zig index 359724501..e7cf8603c 100644 --- a/src/config/url.zig +++ b/src/config/url.zig @@ -110,7 +110,6 @@ const bare_relative_path_branch = dotted_path_lookahead ++ bare_relative_path_prefix ++ path_chars ++ "+" ++ - dotted_path_space_segments ++ no_trailing_colon ++ trailing_spaces_at_eol; @@ -363,6 +362,11 @@ test "url regex" { .input = "/tmp/test folder/file.txt", .expect = "/tmp/test", }, + // unified diff lines + .{ + .input = "diff --git a/src/font/shaper/harfbuzz.zig b/src/font/shaper/harfbuzz.zig", + .expect = "a/src/font/shaper/harfbuzz.zig", + }, // Two space-separated absolute paths should match only the first .{ .input = "/tmp/foo /tmp/bar",