Skip to content

Commit 3334b0c

Browse files
committed
🐛 修复某些匹配情况 #629
1 parent db7d6c7 commit 3334b0c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/pkg/utils/match.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ describe("dealPatternMatches", () => {
166166
"*://*/*",
167167
"*://*.example.com/*",
168168
"*://*.example.com/*",
169-
"*://example.com/*",
169+
"*://*.example.com/*",
170170
"*://*.example.com/path/*",
171171
"*://*/*", // http*
172172
"*://*/*", // 正则

src/pkg/utils/match.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ export function parsePatternMatchesURL(
305305
// *开头但是不是*.的情况
306306
if (result.host.startsWith("*")) {
307307
if (!result.host.startsWith("*.")) {
308-
// 删除开头的*号
309-
result.host = result.host.slice(1);
308+
// 替换为*.
309+
result.host = `*.${result.host.slice(1)}`;
310310
}
311311
}
312312
// 结尾是*的情况

0 commit comments

Comments
 (0)