fix(settings): 兼容 PP 目录接口的字符串总数
build / build (push) Successful in 1m46s

真实 PP 登录正常,目录接口将 Java Long 总数序列化为十进制字符串;新客户端的纯整数判断误报不兼容。
接受规范的非负十进制字符串,并保留对负数、布尔、小数和非规范字符串的拒绝。

验证:新增用例先复现 invalid_response,再完成 9 项 PP 回归;make verify 退出 0。
候选代码在测试站 API 和 worker 容器中均真实登录并读取目录成功,确认消费同一配置。
This commit is contained in:
姚章浩
2026-11-17 20:01:44 +08:00
parent d2f9060b33
commit 0dd4ad2737
2 changed files with 21 additions and 5 deletions
+8 -3
View File
@@ -137,11 +137,16 @@ class Client:
def page(self, token, current=1, size=200):
query = urllib.parse.urlencode({"current": current, "size": size})
data = self.request("/potal/file/back/page?" + query, token=token)
total = data.get("total") if isinstance(data, dict) else None
# PP serializes Java Long counts as canonical decimal strings.
if (isinstance(total, str) and len(total) <= 19 and total.isascii() and total.isdecimal()
and (total == "0" or not total.startswith("0"))):
total = int(total)
if (not isinstance(data, dict) or not isinstance(data.get("list"), list)
or not isinstance(data.get("total"), int) or isinstance(data.get("total"), bool)
or data["total"] < 0 or not isinstance(data.get("hasNextPage"), bool)):
or not isinstance(total, int) or isinstance(total, bool)
or total < 0 or not isinstance(data.get("hasNextPage"), bool)):
raise PPError("invalid_response")
return data
return {**data, "total": total}
def check(self):
try: