web: Do not assume error responses are valid, or our, JSON.

Partially fixes #24815.
This commit is contained in:
Alex Vandiver
2023-07-18 18:19:22 +00:00
committed by Tim Abbott
parent 7efe989a72
commit ba7492a314
21 changed files with 109 additions and 83 deletions

View File

@@ -280,8 +280,7 @@ function create_stream() {
// The rest of the work is done via the subscribe event we will get
},
error(xhr) {
const msg = xhr.responseJSON.msg;
if (msg.includes("access")) {
if (xhr.responseJSON?.msg?.includes("access")) {
// If we can't access the stream, we can safely
// assume it's a duplicate stream that we are not invited to.
//