From bc2867dc6c5ba721da74cbb60a44ce7fe560d15d Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sat, 28 Sep 2024 11:59:56 +0200 Subject: [PATCH] rubicon: Check whether referenced file exists on .dud rejection Otherwise rejecting fails for .dud files that reference non-existent files. Signed-off-by: Sebastian Krzyszkowiak --- src/rubicon/fileimport.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rubicon/fileimport.py b/src/rubicon/fileimport.py index 2191f202..18cb3cfa 100644 --- a/src/rubicon/fileimport.py +++ b/src/rubicon/fileimport.py @@ -151,6 +151,9 @@ def reject_dud_upload( # move the files referenced by the .dud file random_suffix = random_string(4) for fname in dud.get_files(): + if not os.path.exists(fname): + continue + target_fname = os.path.join(conf.rejected_dir, os.path.basename(fname)) if os.path.isfile(target_fname): target_fname = target_fname + '+' + random_suffix