|
@@ -24,7 +24,6 @@ from fastapi.responses import HTMLResponse, JSONResponse
|
|
|
from fastapi.templating import Jinja2Templates
|
|
|
from flask.ctx import _AppCtxGlobals
|
|
|
from starlette.middleware.base import BaseHTTPMiddleware
|
|
|
-from werkzeug.utils import secure_filename
|
|
|
|
|
|
import __main__
|
|
|
from taipy.common.logger._taipy_logger import _TaipyLogger
|
|
@@ -240,17 +239,14 @@ class FastAPIServer(_Server):
|
|
|
and not self._is_ignored(file_path)
|
|
|
):
|
|
|
return send_from_directory(base_path, path)
|
|
|
- sanitized_path = secure_filename(path)
|
|
|
if (
|
|
|
(
|
|
|
- file_path := str(
|
|
|
- os.path.normpath((base_path := self._gui._root_dir + os.path.sep) + sanitized_path)
|
|
|
- ) # type: ignore[attr-defined]
|
|
|
+ file_path := str(os.path.normpath((base_path := self._gui._root_dir + os.path.sep) + path)) # type: ignore[attr-defined]
|
|
|
).startswith(base_path)
|
|
|
and os.path.isfile(file_path)
|
|
|
and not self._is_ignored(file_path)
|
|
|
):
|
|
|
- return send_from_directory(base_path, sanitized_path)
|
|
|
+ return send_from_directory(base_path, path)
|
|
|
|
|
|
# Default error return for unmatched paths
|
|
|
raise HTTPException(status_code=404, detail="")
|