From e488a4338e75f6143d3f15db61cb8def7fccec24 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 6 Apr 2026 13:31:15 +0100 Subject: [PATCH] fix: use correct path for connection diagnostics POST (#7475) * fix: use correct path for connection diagnostics POST The relative path '../ep/pad/connection-diagnostic-info' resolved incorrectly in subdirectory setups. Use absolute path from the application root. Fixes #4191 Co-Authored-By: Claude Opus 4.6 (1M context) * test: verify connection diagnostics endpoint is reachable Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- src/static/js/pad.ts | 2 +- src/tests/backend/specs/apicalls.ts | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/tests/backend/specs/apicalls.ts diff --git a/src/static/js/pad.ts b/src/static/js/pad.ts index 25986a33d..d9cc4e902 100644 --- a/src/static/js/pad.ts +++ b/src/static/js/pad.ts @@ -742,7 +742,7 @@ const pad = { }, asyncSendDiagnosticInfo: () => { const currentUrl = window.location.href; - fetch('../ep/pad/connection-diagnostic-info', { + fetch(`${exports.baseURL}ep/pad/connection-diagnostic-info`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/tests/backend/specs/apicalls.ts b/src/tests/backend/specs/apicalls.ts new file mode 100644 index 000000000..5b4060ccb --- /dev/null +++ b/src/tests/backend/specs/apicalls.ts @@ -0,0 +1,23 @@ +'use strict'; + +const common = require('../common'); + +describe(__filename, function () { + this.timeout(30000); + let agent: any; + before(async function () { agent = await common.init(); }); + + describe('/ep/pad/connection-diagnostic-info', function () { + it('POST with valid diagnosticInfo returns 200', async function () { + await agent.post('/ep/pad/connection-diagnostic-info') + .send({diagnosticInfo: {disconnectedMessage: 'socket.io timeout'}}) + .expect(200); + }); + + it('POST without diagnosticInfo returns 400', async function () { + await agent.post('/ep/pad/connection-diagnostic-info') + .send({}) + .expect(400); + }); + }); +});