Compare commits

...

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
a45a64380c 优化乐云(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>
2026-04-12 11:40:55 +00:00
copilot-swe-agent[bot]
df7442c3dd Initial plan 2026-04-12 11:39:26 +00:00
2 changed files with 21 additions and 2 deletions

View File

@@ -113,9 +113,9 @@ public enum PanDomainTemplate {
"https://www.feijix.com/s/{shareKey}",
FjTool.class),
// https://lecloud.lenovo.com/share/
// https://lecloud.lenovo.com/share/ https://lecloud.lenovo.com/mshare/
LE("联想乐云",
compile("https://lecloud?\\.lenovo\\.com/share/(?<KEY>.+)"),
compile("https://lecloud?\\.lenovo\\.com/m?share/(?<KEY>.+)"),
"https://lecloud.lenovo.com/share/{shareKey}",
LeTool.class),

View File

@@ -129,6 +129,25 @@ public class PanDomainTemplateTest {
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
public void verifyDuplicates() {