fix(parser): 处理小飞机下载错误响应解码异常

捕获不支持的编码及响应体超限异常,明确结束解析请求,补充回归测试。
This commit is contained in:
yokinanya committed 2026-11-16 17:15:49 +08:00
1 parent d692416a2e
commit 25888661ad
2 files changed
+34 -1

No files matched your search

@@ -443,7 +443,14 @@ public class FjTool extends PanBase {
private void down(HttpResponse<Buffer> res2) {
MultiMap headers = res2.headers();
if (StringUtils.isBlank(headers.get("Location"))) {
fail("{}", FjDownloadParams.missingLocation(res2.statusCode(), asText(res2)));
String body;
try {
body = asText(res2);
} catch (IllegalArgumentException | UnsupportedOperationException e) {
fail(e, "读取下载错误响应失败, HTTP {}", res2.statusCode());
return;
}
fail("{}", FjDownloadParams.missingLocation(res2.statusCode(), body));
return;
}
promise.complete(headers.get("Location"));