Skip to content

Commit

Permalink
feat(editor): Gracefully ignore invalid payloads in postMessage handl…
Browse files Browse the repository at this point in the history
…er (#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
  • Loading branch information
netroy authored Dec 19, 2023
1 parent 36a923c commit 9d22c7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4351,7 +4351,7 @@ export default defineComponent({
}
},
async onPostMessageReceived(message: MessageEvent) {
if (!message?.data?.includes?.('"command"')) {
if (!message || typeof message.data !== 'string' || !message.data?.includes?.('"command"')) {
return;
}
try {
Expand Down

0 comments on commit 9d22c7a

Please sign in to comment.