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: v16.2.6~48^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=69f45f87f04b4203442d69a3b8b52b76e7023fa1;p=ceph.git pybind/mgr: check if file contains only spaces Signed-off-by: Varsha Rao (cherry picked from commit 2d32f5f4ec1da7444f60ecaca28f84f2ec1b16a0) --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 4e39b230677..7d9d3555399 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -421,7 +421,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]