refs #2723 Check if file exists and return 400 if info file don´t exists

pull/42/head
Nicolas Arenas 2025-08-29 11:57:14 +02:00
parent 04c9cd7950
commit ae1cec5cd4
1 changed files with 10 additions and 1 deletions

View File

@ -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"):