From a6ab376798097a42bf7e5fa876f86851b6f1b680 Mon Sep 17 00:00:00 2001 From: Daniel Kostro Date: Tue, 10 Feb 2026 17:16:53 +0100 Subject: [PATCH] fix: ensure correct content type resolution when resolving URL data Closes: https://github.com/NPellet/visualizer/issues/1200 --- src/src/util/urldata.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/src/util/urldata.js b/src/src/util/urldata.js index afd8aeb8a..53610bdff 100644 --- a/src/src/util/urldata.js +++ b/src/src/util/urldata.js @@ -36,7 +36,9 @@ define(['src/util/lru', 'src/util/debug'], function (LRU, Debug) { throw new Error(`Expected status === 200, got ${res.status}`); } let data; - if (res.headers.get('Content-Type') === 'application/json') { + // We used to rely on superagent, so this check is copied from the lib to avoid breaking behavior + // https://github.com/forwardemail/superagent/blob/3ef367619fbb2a8d07082238892ae12dafe4b0b0/src/client.js#L256-L260 + if (/[/+]json($|[^-\w])/i.test(res.headers.get('Content-Type'))) { data = await res.json(); } else { data = await res.text();