From 88583dba31f2e49594b50570e5dcf418a3dd1dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= <mateusz.gruszczynski@firma.interia.pl> Date: Mon, 10 Mar 2025 15:21:27 +0100 Subject: [PATCH] poprawka w format_host --- app.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index ecfcb5d..efa4e4e 100644 --- a/app.py +++ b/app.py @@ -1271,15 +1271,16 @@ def deploy_user(user_id): else: chosen_file = default_file - # 🛠Upewniamy się, że final_content nigdy nie jest pusty - final_content = chosen_file.content if chosen_file.content.strip() else "# Empty /etc/hosts file\n" - - # Dodaj regex, jeśli nie jest wyłączony - if not h.disable_regex_deploy and regex_lines.strip(): - final_content = regex_lines + "\n" + final_content - - # Dodaj local-defaults, jeśli nie jest wyłączony - if not h.disable_local_default: + # 🛠Jeśli disable_local_default jest włączone → wgraj tylko wybrany plik hosts + if h.disable_local_default: + final_content = chosen_file.content.strip() + else: + # W przeciwnym wypadku dodaj regex i ensure_local_defaults + final_content = chosen_file.content.strip() + + if not h.disable_regex_deploy and regex_lines.strip(): + final_content = regex_lines + "\n" + final_content + final_content = ensure_local_defaults(final_content, user_id) try: