PP 增加受控凭据更新、真实登录与目录检查,待验证修改不会替换生效配置;扫描与取件共享生效修订。 钉钉来源向导、校验与登记共用 DWS 授权,支持中途恢复与换账号保护,取消旧扫码自动回落。 认证审计复用已有来源审计页,配置响应不回传密码;补齐运行镜像脚本与权限。 验证:make verify 退出 0;PP/DWS/httpapi 目标 race 回归通过;隔离 HTTP 服务验证 PP 协议及扫描/取件消费者。 尚未部署;真实 PP 凭据与目录可用性在测试站部署后验证。
This commit is contained in:
@@ -278,7 +278,7 @@ def pp_find_entry(manifest):
|
||||
def pp_download(manifest, max_bytes):
|
||||
entry = pp_find_entry(manifest)
|
||||
if entry is None:
|
||||
raise MissingSource("PP ledger entry for this locator no longer exists")
|
||||
entry = {}
|
||||
# Ledger titles may omit the extension; recover the true file name from the
|
||||
# local path or source URL before type checks run.
|
||||
manifest_name = manifest.setdefault("name", "")
|
||||
@@ -301,9 +301,23 @@ def pp_download(manifest, max_bytes):
|
||||
if expected_hash and len(expected_hash) == 64 and actual != expected_hash:
|
||||
raise FetchError("PP local copy hash mismatch (ledger changed?)", retryable=True, code="local_mismatch")
|
||||
return str(candidate), size, actual, True
|
||||
url = entry.get("url", "")
|
||||
if not url:
|
||||
raise MissingSource("PP ledger entry has no local file and no download URL")
|
||||
from pp_client import active_client, record_observation, observation, PPError
|
||||
client = None
|
||||
try:
|
||||
client = active_client()
|
||||
inventory = client.inventory(client.login())
|
||||
record_observation(client.config, observation('valid'))
|
||||
except PPError as error:
|
||||
if client is not None:
|
||||
record_observation(client.config, observation(error.state))
|
||||
raise FetchError(str(error), retryable=error.state == 'unavailable', code='pp_' + error.state) from None
|
||||
locator = manifest.get('locator_hash', '')
|
||||
matches = [row for row in inventory['items'] if row.get('online') == 1 and (row.get('potalGroup') or {}).get('groupName') == '公开' and digest_of(str(row.get('fileUrl') or '').strip()) == locator]
|
||||
if not matches:
|
||||
raise MissingSource('PP file is no longer visible in the configured portal')
|
||||
url = str(matches[0].get('fileUrl') or '').strip()
|
||||
if not pathlib.PurePosixPath(manifest['name']).suffix:
|
||||
manifest['name'] += pathlib.PurePosixPath(urllib.parse.unquote(urllib.parse.urlsplit(url).path)).suffix
|
||||
path, size, actual = http_get(url, {}, 180, max_bytes)
|
||||
expected_hash = str(entry.get("sha256", "")).lower()
|
||||
if expected_hash and len(expected_hash) == 64 and actual != expected_hash:
|
||||
|
||||
Reference in New Issue
Block a user