]> BookStack Code Mirror - bookstack/commitdiff
Fixed response JSON detection when charset existed
authorDan Brown <redacted>
Sun, 18 Apr 2021 21:12:26 +0000 (22:12 +0100)
committerDan Brown <redacted>
Sun, 18 Apr 2021 21:12:26 +0000 (22:12 +0100)
Fixes #2684

resources/js/services/http.js

index b05dd23bfd7222834eade6395f655d5916b1b2c1..00865e69bd8ff83698864ed7c6d0dd0042ef465f 100644 (file)
@@ -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();
Morty Proxy This is a proxified and sanitized view of the page, visit original site.