]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: check if file contains only spaces
authorVarsha Rao <varao@redhat.com>
Mon, 17 May 2021 13:37:53 +0000 (19:07 +0530)
committerVarsha Rao <varao@redhat.com>
Tue, 29 Jun 2021 12:43:09 +0000 (18:13 +0530)
Signed-off-by: Varsha Rao <varao@redhat.com>
(cherry picked from commit 2d32f5f4ec1da7444f60ecaca28f84f2ec1b16a0)

src/pybind/mgr/mgr_module.py

index 4e39b2306770bc4babee7326d675f22e33657c6d..7d9d355539919d58400dd1e0108ea3cb2acc4592 100644 (file)
@@ -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]