gui/backend/gui_plugin/core/Files.py
def validate_path(path, web_session=None):
    """Validates the specified path.

    If running in multi-user mode, the directory is relative to the user space and requests
    outside the user space will result in error.
    If running in single-user mode, absolute paths area allowed, but if a relative path is
    supplied, then it will be relative to the system user home directory.
    If the path is empty, "." or "./" it will be resolved as the root to the relative
    path in the running mode.

    Args:
        path (str): The path to a directory or file
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The path to the created file on success.
    """

    try:
        # the rel_path is the full_path on local sessions
        full_path, rel_path = resolve_path(path, web_session)
        return_path = full_path if web_session.is_local_session else rel_path

        if not os.path.exists(full_path):
            raise MSGException(Error.CORE_PATH_NOT_EXIST,
                               "The supplied path does not exist.")

        if not os.access(full_path, os.R_OK):
            raise MSGException(Error.CORE_PERMISSION_DENIED,
                               "No permissions to read from the supplied path.")

        if not os.access(full_path, os.W_OK):
            raise MSGException(Error.CORE_PERMISSION_DENIED,
                               "No permissions to write in the supplied path.")

        result = Response.ok("", {
            "result": {
                "path": return_path
            }
        })

    except Exception as e:  # pragma: no cover
        result = Response.exception(e, {
            "result": {
                # Might happen the resolve_path raises an error
                "path": return_path if 'return_path' in locals() else path
            }
        })

    return result
Validates the specified path.

    If running in multi-user mode, the directory is relative to the user space and requests
    outside the user space will result in error.
    If running in single-user mode, absolute paths area allowed, but if a relative path is
    supplied, then it will be relative to the system user home directory.
    If the path is empty, "." or "./" it will be resolved as the root to the relative
    path in the running mode.

    Args:
        path (str): The path to a directory or file
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The path to the created file on success.
    
Validates the specified path.
If running in multi-user mode, the directory is relative to the user space and requests
outside the user space will result in error.
If running in single-user mode, absolute paths area allowed, but if a relative path is
supplied, then it will be relative to the system user home directory.
If the path is empty, "." or "./" it will be resolved as the root to the relative
path in the running mode.
Validates the specified path . If running in multi - user mode the directory is relative to the user space and requests outside the user space will result in error . If running in single - user mode absolute paths area allowed but if a relative path is supplied then it will be relative to the system user home directory . If the path is empty " . " or " . / " it will be resolved as the root to the relative path in the running mode .
def validate_path(path, web_session=None):
    try:
        full_path, rel_path = resolve_path(path, web_session)
        return_path = full_path if web_session.is_local_session else rel_path
        if not os.path.exists(full_path):
            raise MSGException(Error.CORE_PATH_NOT_EXIST,
                               "The supplied path does not exist.")
        if not os.access(full_path, os.R_OK):
            raise MSGException(Error.CORE_PERMISSION_DENIED,
                               "No permissions to read from the supplied path.")
        if not os.access(full_path, os.W_OK):
            raise MSGException(Error.CORE_PERMISSION_DENIED,
                               "No permissions to write in the supplied path.")
        result = Response.ok("", {
            "result": {
                "path": return_path
            }
        })
    except Exception as e:  
        result = Response.exception(e, {
            "result": {
                "path": return_path if 'return_path' in locals() else path
            }
        })
    return result
def validate_path ( path , web_session = None ) : try : full_path , rel_path = resolve_path ( path , web_session ) return_path = full_path if web_session . is_local_session else rel_path if not os . path . exists ( full_path ) : raise MSGException ( Error . CORE_PATH_NOT_EXIST , "The supplied path does not exist." ) if not os . access ( full_path , os . R_OK ) : raise MSGException ( Error . CORE_PERMISSION_DENIED , "No permissions to read from the supplied path." ) if not os . access ( full_path , os . W_OK ) : raise MSGException ( Error . CORE_PERMISSION_DENIED , "No permissions to write in the supplied path." ) result = Response . ok ( "" , { "result" : { "path" : return_path } } ) except Exception as e : result = Response . exception ( e , { "result" : { "path" : return_path if 'return_path' in locals ( ) else path } } ) return result
Validates the specified path.
Validates the specified path .
"""Validates the specified path.

    If running in multi-user mode, the directory is relative to the user space and requests
    outside the user space will result in error.
    If running in single-user mode, absolute paths area allowed, but if a relative path is
    supplied, then it will be relative to the system user home directory.
    If the path is empty, "." or "./" it will be resolved as the root to the relative
    path in the running mode.

    Args:
        path (str): The path to a directory or file
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The path to the created file on success.
    """ # the rel_path is the full_path on local sessions # pragma: no cover # Might happen the resolve_path raises an error
The path to the created file on success.
The path to the created file on success .
path
The path to a directory or file
The path to a directory or file
web_session
The webserver session object, optional. Will be
passed in my the webserver automatically
The webserver session object optional . Will be passed in my the webserver automatically