mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
🐛 Binary data handling fixes (#2629)
* Update node airtable * Update nodenextcloud * Update node spreadsheet * Update node cortex, dropbox, editImage nodes * Update node emailSend * Update node ftp * Update node googleDrive * Update node googleDrive fix * Update node youtube * Update node htmlExtract * Update node linkedIn * Update node mailgun * Update node matrix * Update node pipedrive * Update node readPdf * Update node facebookGraphApi * Update node httpRequest * Update node nocoDB * Update node httpRequest, respondToWebhook * Update node signi4 * Update node slack * Update node zulip * cleanup * fix generic funcs * 🐛 Fix EditImage Node Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -1179,7 +1179,8 @@ export class EditImage implements INodeType {
|
||||
throw new NodeOperationError(this.getNode(), `Item does not contain any binary data with the name "${dataPropertyName}".`);
|
||||
}
|
||||
|
||||
gmInstance = gm(Buffer.from(item.binary![dataPropertyName as string].data, BINARY_ENCODING));
|
||||
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, dataPropertyName);
|
||||
gmInstance = gm(binaryDataBuffer);
|
||||
gmInstance = gmInstance.background('transparent');
|
||||
}
|
||||
|
||||
@@ -1218,7 +1219,8 @@ export class EditImage implements INodeType {
|
||||
|
||||
const { fd, path, cleanup } = await file();
|
||||
cleanupFunctions.push(cleanup);
|
||||
await fsWriteFileAsync(fd, Buffer.from(item.binary![operationData.dataPropertyNameComposite as string].data, BINARY_ENCODING));
|
||||
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, operationData.dataPropertyNameComposite as string);
|
||||
await fsWriteFileAsync(fd, binaryDataBuffer);
|
||||
|
||||
if (operations[0].operation === 'create') {
|
||||
// It seems like if the image gets created newly we have to create a new gm instance
|
||||
@@ -1349,14 +1351,14 @@ export class EditImage implements INodeType {
|
||||
|
||||
returnData.push(await (new Promise<INodeExecutionData>((resolve, reject) => {
|
||||
gmInstance
|
||||
.toBuffer((error: Error | null, buffer: Buffer) => {
|
||||
.toBuffer(async (error: Error | null, buffer: Buffer) => {
|
||||
cleanupFunctions.forEach(async cleanup => await cleanup());
|
||||
|
||||
if (error) {
|
||||
return reject(error);
|
||||
}
|
||||
|
||||
newItem.binary![dataPropertyName as string].data = buffer.toString(BINARY_ENCODING);
|
||||
newItem.binary![dataPropertyName as string].data = (await this.helpers.prepareBinaryData(Buffer.from(buffer))).data;
|
||||
|
||||
return resolve(newItem);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user