From 5bc66ef505973d8d6327440bfb4fe948af4e573e Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Tue, 24 Jun 2025 08:17:34 +0200 Subject: [PATCH 1/2] Don't loose track of trailing slashes Slashses might be part of the entityID Related to #298 --- src/pyff/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pyff/api.py b/src/pyff/api.py index 10e7b3ad..9763b287 100644 --- a/src/pyff/api.py +++ b/src/pyff/api.py @@ -205,6 +205,10 @@ def _d(x: Optional[str], do_split: bool = True) -> tuple[Optional[str], Optional # Ugly workaround bc WSGI drops double-slashes. path = path.replace(':/', '://') + # Ugly workaround bc request.matchdict drops trailing slashes which could be part of the entityID + if request.path and request.path[-1] == "/": + path = path + "/" + msg = "handling entry={}, alias={}, path={}" log.debug(msg.format(entry, alias, path)) From 95fc660bf8613e0a90bb8c83efc128f211dbec03 Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Thu, 26 Jun 2025 11:42:18 +0200 Subject: [PATCH 2/2] Cache per Content-Type --- src/pyff/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyff/api.py b/src/pyff/api.py index 9763b287..eb49e805 100644 --- a/src/pyff/api.py +++ b/src/pyff/api.py @@ -140,7 +140,7 @@ def request_handler(request: Request) -> Response: :param request: the HTTP request object :return: the data to send to the client """ - key = request.path_qs + key = f"{request.path_qs}_{request.accept}" r = None try: r = request.registry.cache[key]