From 2d32f5f4ec1da7444f60ecaca28f84f2ec1b16a0 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Mon, 17 May 2021 19:07:53 +0530 Subject: [PATCH] pybind/mgr: check if file contains only spaces Signed-off-by: Varsha Rao --- src/pybind/mgr/mgr_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 07ed288199ea..8ca80b6794df 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -417,7 +417,7 @@ def CLICheckNonemptyFileInput(func: HandlerFuncType) -> HandlerFuncType: if isinstance(kwargs['inbuf'], str): # Delete new line separator at EOF (it may have been added by a text editor). kwargs['inbuf'] = kwargs['inbuf'].rstrip('\r\n').rstrip('\n') - if not kwargs['inbuf']: + if not kwargs['inbuf'] or not kwargs['inbuf'].strip(): return -errno.EINVAL, '', ERROR_MSG_EMPTY_INPUT_FILE return func(*args, **kwargs) check.__signature__ = inspect.signature(func) # type: ignore[attr-defined] -- 2.47.3