Skip to content

Commit b64b139

Browse files
fix tprh warning designer (#1980) (#1987)
* fix tprh warning designer * Update server.py * only send message * update (cherry picked from commit d4529c8) Co-authored-by: Dinh Long Nguyen <[email protected]>
1 parent afbb7b9 commit b64b139

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

taipy/gui/server.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@
2323
from importlib import util
2424
from random import choices, randint
2525

26-
from flask import Blueprint, Flask, json, jsonify, render_template, request, send_from_directory
26+
from flask import (
27+
Blueprint,
28+
Flask,
29+
json,
30+
jsonify,
31+
make_response,
32+
render_template,
33+
request,
34+
send_from_directory,
35+
)
2736
from flask_cors import CORS
2837
from flask_socketio import SocketIO
2938
from gitignore_parser import parse_gitignore
@@ -160,7 +169,13 @@ def my_index(path):
160169
if resource_handler_id is not None:
161170
resource_handler = _ExternalResourceHandlerManager().get(resource_handler_id)
162171
if resource_handler is None:
163-
return (f"Invalid value for query {_Server._RESOURCE_HANDLER_ARG}", 404)
172+
response = make_response(
173+
"Cookie was deleted due to invalid resource handler id. Please restart the page manually.", 400
174+
)
175+
response.set_cookie(
176+
_Server._RESOURCE_HANDLER_ARG, "", secure=request.is_secure, httponly=True, expires=0, path="/"
177+
)
178+
return response
164179
try:
165180
return resource_handler.get_resources(path, static_folder, base_url)
166181
except Exception as e:

0 commit comments

Comments
 (0)