From e61b7a95609e900dd8bca7d61cfcb16e49734821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mih=C3=A1lik?= Date: Fri, 13 Dec 2024 23:46:15 +0100 Subject: [PATCH] Exclude macos metadata folder --- competition/views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/competition/views.py b/competition/views.py index 2555b67..a4e43ee 100644 --- a/competition/views.py +++ b/competition/views.py @@ -373,7 +373,15 @@ def upload_solutions_with_points(self, request, pk=None): errors = [] # TODO: checks file are really pdfs - for filename in filter(lambda filename: filename.endswith('.pdf'), zfile.namelist()): + for filename in zfile.namelist(): + if not filename.endswith(".pdf"): + # Ignore other non-pdf files in the archive + continue + + if "__MACOSX" in filename: + # Ignore mac os metadata folder + continue + try: parts = filename.rstrip('.pdf').split('-') score = int(parts[0])