From d4529c8980dfbc4db9b90e67514db6a489234c20 Mon Sep 17 00:00:00 2001 From: Dinh Long Nguyen Date: Wed, 9 Oct 2024 15:49:08 +0700 Subject: [PATCH] fix tprh warning designer (#1980) * fix tprh warning designer * Update server.py * only send message * update --- taipy/gui/server.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/taipy/gui/server.py b/taipy/gui/server.py index 80a1f1c6ff..857f275e14 100644 --- a/taipy/gui/server.py +++ b/taipy/gui/server.py @@ -23,7 +23,16 @@ from importlib import util from random import choices, randint -from flask import Blueprint, Flask, json, jsonify, render_template, request, send_from_directory +from flask import ( + Blueprint, + Flask, + json, + jsonify, + make_response, + render_template, + request, + send_from_directory, +) from flask_cors import CORS from flask_socketio import SocketIO from gitignore_parser import parse_gitignore @@ -160,7 +169,13 @@ def my_index(path): if resource_handler_id is not None: resource_handler = _ExternalResourceHandlerManager().get(resource_handler_id) if resource_handler is None: - return (f"Invalid value for query {_Server._RESOURCE_HANDLER_ARG}", 404) + response = make_response( + "Cookie was deleted due to invalid resource handler id. Please restart the page manually.", 400 + ) + response.set_cookie( + _Server._RESOURCE_HANDLER_ARG, "", secure=request.is_secure, httponly=True, expires=0, path="/" + ) + return response try: return resource_handler.get_resources(path, static_folder, base_url) except Exception as e: