mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-04-13 12:26:55 +00:00
优化乐云(LE)正则以支持 /mshare/ 格式,补充测试用例
Agent-Logs-Url: https://github.com/qaiu/netdisk-fast-download/sessions/7341ab49-5648-498c-b153-0fcd3b3f8aad Co-authored-by: qaiu <29825328+qaiu@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
df7442c3dd
commit
a45a64380c
@@ -113,9 +113,9 @@ public enum PanDomainTemplate {
|
|||||||
"https://www.feijix.com/s/{shareKey}",
|
"https://www.feijix.com/s/{shareKey}",
|
||||||
FjTool.class),
|
FjTool.class),
|
||||||
|
|
||||||
// https://lecloud.lenovo.com/share/
|
// https://lecloud.lenovo.com/share/ https://lecloud.lenovo.com/mshare/
|
||||||
LE("联想乐云",
|
LE("联想乐云",
|
||||||
compile("https://lecloud?\\.lenovo\\.com/share/(?<KEY>.+)"),
|
compile("https://lecloud?\\.lenovo\\.com/m?share/(?<KEY>.+)"),
|
||||||
"https://lecloud.lenovo.com/share/{shareKey}",
|
"https://lecloud.lenovo.com/share/{shareKey}",
|
||||||
LeTool.class),
|
LeTool.class),
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,25 @@ public class PanDomainTemplateTest {
|
|||||||
wsPattern.matcher("https://www.evil.com/f/abc123").matches());
|
wsPattern.matcher("https://www.evil.com/f/abc123").matches());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLePatternMatching() {
|
||||||
|
Pattern lePattern = PanDomainTemplate.LE.getPattern();
|
||||||
|
|
||||||
|
// /share/ 格式
|
||||||
|
Matcher m1 = lePattern.matcher("https://lecloud.lenovo.com/share/abc123");
|
||||||
|
assertTrue("LE pattern should match /share/ format", m1.matches());
|
||||||
|
assertEquals("abc123", m1.group("KEY"));
|
||||||
|
|
||||||
|
// /mshare/ 格式
|
||||||
|
Matcher m2 = lePattern.matcher("https://lecloud.lenovo.com/mshare/xyz789");
|
||||||
|
assertTrue("LE pattern should match /mshare/ format", m2.matches());
|
||||||
|
assertEquals("xyz789", m2.group("KEY"));
|
||||||
|
|
||||||
|
// 负例:错误路径不匹配
|
||||||
|
assertFalse("Wrong path should not match",
|
||||||
|
lePattern.matcher("https://lecloud.lenovo.com/s/abc123").matches());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void verifyDuplicates() {
|
public void verifyDuplicates() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user