mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
feat(editor): Gracefully ignore invalid payloads in postMessage handler (#8096)
It's possible for browser extensions to send `message` events to an n8n window. This change improves the already existing check to ignore invalid messages. Fixes https://community.n8n.io/t/errors-in-the-browser-console-on-n8n-1-version/33910
This commit is contained in:
parent
36a923cf7b
commit
9d22c7a278
|
@ -4351,7 +4351,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onPostMessageReceived(message: MessageEvent) {
|
async onPostMessageReceived(message: MessageEvent) {
|
||||||
if (!message?.data?.includes?.('"command"')) {
|
if (!message || typeof message.data !== 'string' || !message.data?.includes?.('"command"')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue