From 6f9203c98c0f66be11a8f158331bd3b6d0241713 Mon Sep 17 00:00:00 2001 From: axolotle Date: Wed, 29 Nov 2023 14:09:36 +0100 Subject: [PATCH] form:FileOption: fix cli file check --- src/tests/test_questions.py | 2 +- src/utils/form.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/test_questions.py b/src/tests/test_questions.py index 744683086..889979114 100644 --- a/src/tests/test_questions.py +++ b/src/tests/test_questions.py @@ -1298,7 +1298,7 @@ class TestFile(BaseTest): def test_basic_attrs(self): raw_option, option, value = self._test_basic_attrs() - accept = raw_option.get("accept", "") # accept default + accept = raw_option.get("accept", None) # accept default assert option.accept == accept def test_options_prompted_with_ask_help(self): diff --git a/src/utils/form.py b/src/utils/form.py index 76349c07f..a7e7f781e 100644 --- a/src/utils/form.py +++ b/src/utils/form.py @@ -1317,7 +1317,7 @@ class FileOption(BaseInputOption): if Moulinette.interface.type != "api": path = Path(value) - if not (path.exists() or path.is_absolute() or path.is_file()): + if not (path.exists() and path.is_absolute() and path.is_file()): raise YunohostValidationError("File doesn't exists", raw_msg=True) content = path.read_bytes() else: