From ae1cec5cd4ea229288078cc5d09c4eabf3577ec5 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Fri, 29 Aug 2025 11:57:14 +0200 Subject: [PATCH] =?UTF-8?q?refs=20#2723=20Check=20if=20file=20exists=20and?= =?UTF-8?q?=20return=20400=20if=20info=20file=20don=C2=B4t=20exists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/repo_api.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/repo_api.py b/api/repo_api.py index 705a2dc..718159c 100644 --- a/api/repo_api.py +++ b/api/repo_api.py @@ -1320,7 +1320,16 @@ def create_torrent_sum(): journal.send("{'component':'ogRepo', 'severity':'WARNING', 'http_code':'400', 'operation':'Run endpoint create_torrent_sum', 'desc':'Warning: Image not found'}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api") return jsonify({ "success": False, - "exception": "Image not found" + "exception": f"{repo_path}{image_name} Image not found" + }), 400 + + # Chequeamos que el archivo checked.info existe y si no existe devolvemos error y salimos del endpoint: + if not check_file_exists(f"{repo_path}{image_name}.info.checked"): + journal.send("Checked info file not found", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG") + journal.send("{'component':'ogRepo', 'severity':'WARNING', 'http_code':'400', 'operation':'Run endpoint create_torrent_sum', 'desc':'Warning: Checked info file not found'}", PRIORITY=journal.LOG_WARNING, SYSLOG_IDENTIFIER="ogrepo-api") + return jsonify({ + "success": False, + "exception": f"{repo_path}{image_name}.info.checked file not found" }), 400 # Construimos la ruta de la imagen (relativa a "repo_path"):