feat: sync latest ARR implementation

This commit is contained in:
Wyndham ARR
2026-07-31 15:11:42 +08:00
parent d6f8a747fa
commit bf7939dd1a
185 changed files with 17527 additions and 2260 deletions

View File

@@ -12,6 +12,7 @@ API_VERSION = "1.0"
MAX_UPLOAD_BYTES = 25 * 1024 * 1024
MONTH_RE = re.compile(r"^(\d{4})-(\d{2})$")
SAFE_FILENAME_RE = re.compile(r"^[^/\\\x00-\x1f\x7f]{1,255}$")
JOB_ID_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$")
class PortalError(RuntimeError):
@@ -42,6 +43,12 @@ def validate_upload_filename(value: object) -> str:
return value
def validate_job_id(value: object) -> str:
if not isinstance(value, str) or JOB_ID_RE.fullmatch(value) is None:
raise PortalError("JOB_ID_INVALID", "任务编号无效")
return value
def validate_xml_payload(value: bytes) -> None:
if not value:
raise PortalError("UPLOAD_EMPTY", "XML 文件为空")