From: Dan Brown Date: Sun, 18 Apr 2021 21:12:26 +0000 (+0100) Subject: Fixed response JSON detection when charset existed X-Git-Tag: v21.04.1~1^2~4 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/0c880def5e99ae339a8cc03e1d753fce70231b66 Fixed response JSON detection when charset existed Fixes #2684 --- diff --git a/resources/js/services/http.js b/resources/js/services/http.js index b05dd23bf..00865e69b 100644 --- a/resources/js/services/http.js +++ b/resources/js/services/http.js @@ -149,8 +149,8 @@ async function getResponseContent(response) { return null; } - const responseContentType = response.headers.get('Content-Type'); - const subType = responseContentType.split('/').pop(); + const responseContentType = response.headers.get('Content-Type') || ''; + const subType = responseContentType.split(';')[0].split('/').pop(); if (subType === 'javascript' || subType === 'json') { return await response.json();