mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
fix(core & function nodes): Update function nodes to work with binary-data-mode 'filesystem'. (#3845)
* Initial Fix * Self-Review #1 * Lint * Added support for FunctionItem. Minor updates. * Self-review * review comments. Added testing. * Self Review * Fixed memory handling on data manager use. * Fixes for unnecessary memory leaks.
This commit is contained in:
@@ -50,15 +50,23 @@ export class BinaryDataManager {
|
||||
): Promise<IBinaryData> {
|
||||
const retBinaryData = binaryData;
|
||||
|
||||
// If a manager handles this binary, return the binary data with it's reference id.
|
||||
if (this.managers[this.binaryDataMode]) {
|
||||
return this.managers[this.binaryDataMode]
|
||||
.storeBinaryData(binaryBuffer, executionId)
|
||||
.then((filename) => {
|
||||
// Add data manager reference id.
|
||||
retBinaryData.id = this.generateBinaryId(filename);
|
||||
|
||||
// Prevent preserving data in memory if handled by a data manager.
|
||||
retBinaryData.data = this.binaryDataMode;
|
||||
|
||||
// Short-circuit return to prevent further actions.
|
||||
return retBinaryData;
|
||||
});
|
||||
}
|
||||
|
||||
// Else fallback to storing this data in memory.
|
||||
retBinaryData.data = binaryBuffer.toString(BINARY_ENCODING);
|
||||
return binaryData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user