From d5cfbebed539b539bf62fa85bd9ebfe0cce41127 Mon Sep 17 00:00:00 2001 From: stellarshenson Date: Tue, 6 Jan 2026 20:52:12 +0100 Subject: [PATCH] fix: URL handling in admin fetch interceptor and nav links - Handle URL objects (not just strings) in fetch interceptor - Strip query params before checking isUserCreation endpoint - Remove duplicate 'hub' prefix from authorize/change-password links --- services/jupyterhub/templates_enhanced/admin.html | 6 ++++-- services/jupyterhub/templates_enhanced/page.html | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/services/jupyterhub/templates_enhanced/admin.html b/services/jupyterhub/templates_enhanced/admin.html index 0fe618f..31cfbaa 100644 --- a/services/jupyterhub/templates_enhanced/admin.html +++ b/services/jupyterhub/templates_enhanced/admin.html @@ -79,8 +79,10 @@ console.log('[Admin Fetch]', method, url); - // Check for user creation - const isUserCreation = method === 'POST' && url.includes('api/users') && !url.includes('?'); + // Check for user creation - POST to api/users (may have ?_xsrf query param) + // Exclude URLs with other query params like include_stopped_servers + const urlPath = url.split('?')[0]; + const isUserCreation = method === 'POST' && urlPath.endsWith('api/users'); // Capture request body before fetch (for batch user creation) let requestUsernames = []; diff --git a/services/jupyterhub/templates_enhanced/page.html b/services/jupyterhub/templates_enhanced/page.html index 9b757f3..5f3c2b4 100644 --- a/services/jupyterhub/templates_enhanced/page.html +++ b/services/jupyterhub/templates_enhanced/page.html @@ -151,11 +151,11 @@ Admin {% endif %} {% if services %}