Read uploaded ZIPs consistently across Python versions
This commit is contained in:
+2
-1
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user