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""):