]> git.apps.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>
Wed, 26 May 2021 06:08:13 +0000 (11:38 +0530)
Signed-off-by: Varsha Rao <varao@redhat.com>
src/pybind/mgr/mgr_module.py

index 07ed288199eaaec4bd06812b540989f11522b846..8ca80b6794df28c5f664a010a16acd82404018d3 100644 (file)
@@ -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]