fix: ParserCreate 正则匹配 PWD 组时捕获 IllegalArgumentException

matcher.group(PWD) 在正则未定义 PWD 命名组时抛出
IllegalArgumentException 而非 IllegalStateException,原 catch 未覆盖
导致无提取码的链接(如QQ文件分享)返回 500。
This commit is contained in:
yukaidi
2026-05-29 10:13:22 +08:00
parent c62e109aff
commit 4a0fe61d30

View File

@@ -81,7 +81,7 @@ public class ParserCreate {
if (shareKey != null) { if (shareKey != null) {
shareLinkInfo.setShareKey(shareKey); shareLinkInfo.setShareKey(shareKey);
} }
} catch (IllegalStateException ignored) {} } catch (IllegalStateException | IllegalArgumentException ignored) {}
// 提取密码 // 提取密码
try { try {
@@ -89,7 +89,7 @@ public class ParserCreate {
if (StringUtils.isNotEmpty(pwd)) { if (StringUtils.isNotEmpty(pwd)) {
shareLinkInfo.setSharePassword(pwd); shareLinkInfo.setSharePassword(pwd);
} }
} catch (IllegalStateException ignored) {} } catch (IllegalStateException | IllegalArgumentException ignored) {}
// 设置标准URL // 设置标准URL
if (customParserConfig.getStandardUrlTemplate() != null) { if (customParserConfig.getStandardUrlTemplate() != null) {
@@ -133,7 +133,7 @@ public class ParserCreate {
shareLinkInfo.setSharePassword(pwd); shareLinkInfo.setSharePassword(pwd);
} }
standardUrl = standardUrl.replace("{pwd}", pwd); standardUrl = standardUrl.replace("{pwd}", pwd);
} catch (IllegalStateException ignored) {} } catch (IllegalStateException | IllegalArgumentException ignored) {}
shareLinkInfo.setShareUrl(shareUrl); shareLinkInfo.setShareUrl(shareUrl);
shareLinkInfo.setShareKey(shareKey); shareLinkInfo.setShareKey(shareKey);
@@ -266,14 +266,14 @@ public class ParserCreate {
if (shareKey != null) { if (shareKey != null) {
shareLinkInfo.setShareKey(shareKey); shareLinkInfo.setShareKey(shareKey);
} }
} catch (IllegalStateException ignored) {} } catch (IllegalStateException | IllegalArgumentException ignored) {}
try { try {
String password = matcher.group("PWD"); String password = matcher.group("PWD");
if (password != null) { if (password != null) {
shareLinkInfo.setSharePassword(password); shareLinkInfo.setSharePassword(password);
} }
} catch (IllegalStateException ignored) {} } catch (IllegalStateException | IllegalArgumentException ignored) {}
// 设置标准URL如果有模板 // 设置标准URL如果有模板
if (customConfig.getStandardUrlTemplate() != null) { if (customConfig.getStandardUrlTemplate() != null) {