refactor(core): fixes n8n-local-rules/no-json-parse-json-stringify warnings (#4407)

* 🔨 fixes

* 🔨 set rule to error
This commit is contained in:
Michael Kret
2022-10-21 18:24:58 +03:00
committed by GitHub
parent e10128cbea
commit 9d6a2c32d7
21 changed files with 75 additions and 50 deletions

View File

@@ -2,6 +2,7 @@ import { ContainerOptions, create_container, EventContext, Message, ReceiverOpti
import { ITriggerFunctions } from 'n8n-core';
import {
deepCopy,
IDataObject,
INodeType,
INodeTypeDescription,
@@ -172,20 +173,20 @@ export class AmqpTrigger implements INodeType {
if (options.jsonConvertByteArrayToString === true && data.body.content !== undefined) {
// The buffer is not ready... Stringify and parse back to load it.
const cont = JSON.stringify(data.body.content);
data.body = String.fromCharCode.apply(null, JSON.parse(cont).data);
const cont = deepCopy(data.body.content);
data.body = String.fromCharCode.apply(null, cont.data);
}
if (options.jsonConvertByteArrayToString === true && data.body.content !== undefined) {
// The buffer is not ready... Stringify and parse back to load it.
const cont = JSON.stringify(data.body.content);
data.body = String.fromCharCode.apply(null, JSON.parse(cont).data);
const cont = deepCopy(data.body.content);
data.body = String.fromCharCode.apply(null, cont.data);
}
if (options.jsonConvertByteArrayToString === true && data.body.content !== undefined) {
// The buffer is not ready... Stringify and parse back to load it.
const content = JSON.stringify(data.body.content);
data.body = String.fromCharCode.apply(null, JSON.parse(content).data);
const content = deepCopy(data.body.content);
data.body = String.fromCharCode.apply(null, content.data);
}
if (options.jsonParseBody === true) {