1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-01-30 04:30:56 +02:00

Fix: Prevent rare error from websocket connection (unexpected non-whitespace character)

This commit is contained in:
Ralph Slooten 2024-01-03 13:09:06 +13:00
parent dd57596fd1
commit 381813fe63

View File

@ -41,10 +41,13 @@ export default {
let ws = new WebSocket(this.socketURI)
let self = this
ws.onmessage = function (e) {
let response = JSON.parse(e.data)
if (!response) {
let response
try {
response = JSON.parse(e.data)
} catch (e) {
return
}
// new messages
if (response.Type == "new" && response.Data) {
if (!mailbox.searching) {
@ -88,7 +91,7 @@ export default {
// detect version updated, refresh is needed
if (self.version != response.Data.Version) {
location.reload();
location.reload()
}
}
}