mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-29 18:43:56 +00:00
url: do not match on //
Double-slash comments are not paths so do not match on them.
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\-.]*\/)*(?<!\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 (/, ./, ../).
|
||||
@@ -472,6 +472,9 @@ test "url regex" {
|
||||
"foo$BAR/baz.txt",
|
||||
// ~ should not match mid-word
|
||||
"foo~/bar.txt",
|
||||
// double-slash comments are not paths
|
||||
"// foo bar",
|
||||
"//foo",
|
||||
};
|
||||
for (no_match_cases) |input| {
|
||||
var result = re.search(input, .{});
|
||||
|
||||
Reference in New Issue
Block a user