mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 19:45:49 +00:00
url: fix , handling for spaced paths
Update path_space_segments patterns to consistently handle comma-delimiters.
This commit is contained in:
@@ -61,11 +61,11 @@ const non_dotted_path_lookahead =
|
||||
;
|
||||
|
||||
const dotted_path_space_segments =
|
||||
\\(?: [\w\-.~:\/?#@!$&*+,;=%]*[\/.])*
|
||||
\\(?: [\w\-.~:\/?#@!$&*+;=%]*[\/.])*
|
||||
;
|
||||
|
||||
const any_path_space_segments =
|
||||
\\(?: [\w\-.~:\/?#@!$&*+,;=%]+)*
|
||||
\\(?: [\w\-.~:\/?#@!$&*+;=%]+)*
|
||||
;
|
||||
|
||||
// Branch 1: URLs with explicit schemes (http, mailto, ftp, etc.).
|
||||
@@ -434,6 +434,15 @@ test "url regex" {
|
||||
.input = "2024/report.txt",
|
||||
.expect = "2024/report.txt",
|
||||
},
|
||||
// comma should stop matching in spaced path segments
|
||||
.{
|
||||
.input = "./foo bar,baz",
|
||||
.expect = "./foo bar",
|
||||
},
|
||||
.{
|
||||
.input = "/tmp/foo bar,baz",
|
||||
.expect = "/tmp/foo bar",
|
||||
},
|
||||
};
|
||||
|
||||
for (cases) |case| {
|
||||
|
||||
Reference in New Issue
Block a user