🐛 fix: 整合官方 2.7.1 修复并升级定制版本

* 校验变更的出站地址并保留现有内部 CloudDrive 配置
* 修复未知长度上传、API 404 语义及下载令牌比较
* 合并 S3 小分片为符合最小尺寸要求的 multipart 部分
* 同步官方运行依赖、版本元数据和已推送前端版本
* 验证单元集成、覆盖率及定制上传下载兼容并记录整合范围
This commit is contained in:
orion committed 2026-10-07 00:16:11 +08:00
1 parent 9ce9810b3b
commit 3b6949d862
14 files changed
+355 -31

No files matched your search

+15 -1
View File
@@ -20,7 +20,8 @@ from core.settings import (
settings,
)
from core.config import refresh_settings
from core.security import INTERNAL_CONFIG_KEYS, generate_jwt_secret
from core.security import (INTERNAL_CONFIG_KEYS, generate_jwt_secret,
OUTBOUND_ENDPOINT_CONFIG_KEYS, validate_outbound_endpoint, validate_outbound_hostname)
from apps.base.models import FileCodes, KeyValue, ShareCodeReservations, TransferStats, file_codes_pydantic
from apps.base.utils import get_expire_info, get_random_code, validate_expire_style
@@ -1855,6 +1856,19 @@ class ConfigService:
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from exc
# Existing internal NAS/CloudDrive endpoints remain valid for unrelated saves.
# Validate only changed destinations, matching upstream 2.7.1 semantics.
for endpoint_key in OUTBOUND_ENDPOINT_CONFIG_KEYS:
candidate = str(next_config.get(endpoint_key) or "")
current = str(current_config.get(endpoint_key) or "")
if candidate == current:
continue
validator = validate_outbound_hostname if endpoint_key == "s3_hostname" else validate_outbound_endpoint
try:
next_config[endpoint_key] = await asyncio.to_thread(validator, candidate)
except ValueError as exc:
raise HTTPException(400, str(exc)) from exc
if admin_password_changed:
next_config["jwt_secret"] = generate_jwt_secret()