From 86edf97c50b601637fc00846fc801b30a8358f50 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Sat, 19 Sep 2026 15:39:51 +0330 Subject: [PATCH] Read uploaded ZIPs consistently across Python versions --- photo-upload/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/photo-upload/app.py b/photo-upload/app.py index 2649ec3..1545a43 100644 --- a/photo-upload/app.py +++ b/photo-upload/app.py @@ -189,7 +189,8 @@ def create_app(data_dir=None, token=None): if photos or len(archives) != 1: abort(400, "Send either photos or one ZIP archive, not both") try: - with zipfile.ZipFile(archives[0].stream) as archive: + # Python 3.10's SpooledTemporaryFile lacks ZipFile's seekable API. + with zipfile.ZipFile(io.BytesIO(archives[0].read())) as archive: members = [item for item in archive.infolist() if not item.is_dir() and not item.filename.startswith("__MACOSX/") and Path(item.filename).name != ".DS_Store"]