From: Varsha Rao Date: Mon, 17 May 2021 13:37:53 +0000 (+0530) Subject: pybind/mgr: check if file contains only spaces X-Git-Tag: v17.1.0~1822^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d32f5f4ec1da7444f60ecaca28f84f2ec1b16a0;p=ceph.git pybind/mgr: check if file contains only spaces Signed-off-by: Varsha Rao --- 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]