TotallyInformation / node-red-contrib-fs

Node-Red node template for host filing system handling
Apache License 2.0
15 stars 6 forks source link

The node clones the message which is a problem for some use cases #23

Open michaelblight opened 4 years ago

michaelblight commented 4 years ago

Before logging an issue, please make sure that you are using latest version on npm. If you are testing a development version (@next on npm or the version on GitHub), please make sure that you let me know as well.

Please ensure that as much of the following information is included as possible:

Software and Package Versions

Software Version
Node.JS v10.22.1
npm 6.14.4
Node-RED v1.2.2
fs node 1.3.2
OS Ubuntu 18.04
Browser Chrome

Note that a browser version less than current-2 or IE < v11 very unlikely to work.

How is Node-RED installed? Where is uibuilder installed?

The official docker image

Often, issues with nodes occur because of non-standard installations. This may still indicate a bug so it is fine to report an issue. Just be sure you understand the consequences of how you have installed things.

A very common set of issues come from installing nodes as root instead of the user that runs Node-RED (e.g. using sudo on Mac/Linux). You will most likely be asked to undo that before we can analyse the issue.

Also quite common is to install the uibuilder node in the wrong folder. It is best to install using the Node-RED admin interface "Manage Palette". If installing manually, make sure you are in your userDir folder before installing (typically ~/.node-red).

I'm using fs-file-lister in a flow where maintaining the existing message is important. However, this node clones the message, which "breaks" my flow. It would be helpful if this node did not clone, or at least had the option to not clone.

michaelblight commented 2 years ago

Haha came back lloking for this issue almost exactly two years later and found I already raised it. This is now a bigger problem with "link call" as the return link is lost. You can probably copy the value into origPayload, and copy it back out after, but you shouldn't have to.

EDIT: Looking into the code, the problem is line 254 sends a brand new message. If you tell it to send an array instead, it will send clonedMsg (where payload is now an array), which still has msg._linkSource and anything else from the input message.