root = root.resolve()
    full_path = (root / user_path).resolve()
    if not is_relative_to(full_path, root):
        raise FileValidationError(
            f"Path {user_path} is outside of the allowed directory {root}"
        )
    return full_path