api: _sha256 补类型注解 str|Path

This commit is contained in:
lou
2026-08-09 23:35:36 +08:00
parent 554dd34788
commit e782a92a0c
+2 -1
View File
@@ -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""):