

def validate_absolute_path(self, root, absolute_path):
    "Validate and return the absolute path.\n\n        ``root`` is the configured path for the `StaticFileHandler`,\n        and ``path`` is the result of `get_absolute_path`\n\n        This is an instance method called during request processing,\n        so it may raise `HTTPError` or use methods like\n        `RequestHandler.redirect` (return None after redirecting to\n        halt further processing).  This is where 404 errors for missing files\n        are generated.\n\n        This method may modify the path before returning it, but note that\n        any such modifications will not be understood by `make_static_url`.\n\n        In instance methods, this method's result is available as\n        ``self.absolute_path``.\n\n        .. versionadded:: 3.1\n        "
    root = os.path.abspath(root)
    if (not (absolute_path + os.path.sep).startswith(root)):
        raise HTTPError(403, '%s is not in root static directory', self.path)
    if (os.path.isdir(absolute_path) and (self.default_filename is not None)):
        if (not self.request.path.endswith('/')):
            self.redirect((self.request.path + '/'), permanent=True)
            return
        absolute_path = os.path.join(absolute_path, self.default_filename)
    if (not os.path.exists(absolute_path)):
        raise HTTPError(404)
    if (not os.path.isfile(absolute_path)):
        raise HTTPError(403, '%s is not a file', self.path)
    return absolute_path

dataset/ETHPy150Open RobotWebTools/rosbridge_suite/rosbridge_server/src/tornado/web.py StaticFileHandler.validate_absolute_path/original