mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
🐛 Fix issue getting binary data when filesystem mode is used - Move Binary Data (#2727)
* 🐛 Fix issue getting binary data when filesystem mode is used * ⚡ Simplifications Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
48b2a0b857
commit
3cde6bd426
|
@ -394,18 +394,23 @@ export class MoveBinaryData implements INodeType {
|
|||
}
|
||||
|
||||
const encoding = (options.encoding as string) || 'utf8';
|
||||
let convertedValue = value.data;
|
||||
|
||||
const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, sourceKey);
|
||||
|
||||
let convertedValue: string;
|
||||
|
||||
if (setAllData === true) {
|
||||
// Set the full data
|
||||
convertedValue = iconv.decode(Buffer.from(convertedValue, BINARY_ENCODING), encoding, { stripBOM: options.stripBOM as boolean });
|
||||
convertedValue = iconv.decode(buffer, encoding, { stripBOM: options.stripBOM as boolean });
|
||||
newItem.json = JSON.parse(convertedValue);
|
||||
} else {
|
||||
// Does get added to existing data so copy it first
|
||||
newItem.json = JSON.parse(JSON.stringify(item.json));
|
||||
|
||||
if (options.keepAsBase64 !== true) {
|
||||
convertedValue = iconv.decode(Buffer.from(convertedValue, BINARY_ENCODING), encoding, { stripBOM: options.stripBOM as boolean });
|
||||
convertedValue = iconv.decode(buffer, encoding, { stripBOM: options.stripBOM as boolean });
|
||||
} else {
|
||||
convertedValue = Buffer.from(buffer).toString(BINARY_ENCODING);
|
||||
}
|
||||
|
||||
if (options.jsonParse) {
|
||||
|
|
Loading…
Reference in a new issue