From e782a92a0c983f880ffe23d18fa590cda217aef3 Mon Sep 17 00:00:00 2001 From: lou Date: Sun, 9 Aug 2026 23:35:36 +0800 Subject: [PATCH] =?UTF-8?q?api:=20=5Fsha256=20=E8=A1=A5=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=20str|Path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index 43e26dc..1e912b4 100644 --- a/api.py +++ b/api.py @@ -12,6 +12,7 @@ API 层 (api) """ import hashlib +from pathlib import Path from fastapi import FastAPI, Request from fastapi.responses import JSONResponse @@ -39,7 +40,7 @@ storage = Storage(tasks, STORAGE_ROOT) app = FastAPI(title="7z-encrypt 服务端") -def _sha256(path) -> str: +def _sha256(path: str | Path) -> str: h = hashlib.sha256() with open(path, "rb") as f: for chunk in iter(lambda: f.read(1 << 20), b""):