mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 22:10:29 +00:00
url: fix tilde mid-word partial matches
Don't match `~` mid-word or before `/`.
This commit is contained in:
@@ -75,7 +75,7 @@ const scheme_url_branch =
|
||||
no_trailing_punctuation;
|
||||
|
||||
const rooted_or_relative_path_prefix =
|
||||
\\(?:\.\.\/|\.\/|~\/|(?:[\w][\w\-.]*\/)*(?<!\w)\$[A-Za-z_]\w*\/|\.[\w][\w\-.]*\/|(?<!\w)\/)
|
||||
\\(?:\.\.\/|\.\/|(?<!\w)~\/|(?:[\w][\w\-.]*\/)*(?<!\w)\$[A-Za-z_]\w*\/|\.[\w][\w\-.]*\/|(?<![\w~])\/)
|
||||
;
|
||||
|
||||
// Branch 2: Absolute paths and dot-relative paths (/, ./, ../).
|
||||
@@ -461,6 +461,8 @@ test "url regex" {
|
||||
"foo/bar,baz.txt",
|
||||
// $VAR should not match mid-word
|
||||
"foo$BAR/baz.txt",
|
||||
// ~ should not match mid-word
|
||||
"foo~/bar.txt",
|
||||
};
|
||||
for (no_match_cases) |input| {
|
||||
var result = re.search(input, .{});
|
||||
|
||||
Reference in New Issue
Block a user