TotallyInformation / node-red-contrib-fs

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

Files without extension are not listed, even with file pattern "*" #24

Open ChrisFromMcAfee opened 3 years ago

ChrisFromMcAfee commented 3 years ago

Software and Package Versions

Software Version
Node.JS
npm 7.18.1
Node-RED 1.3.5
fs node 1.4.1
OS CentOS 7
Browser Chrome

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

Local install based on node-red website readme.

Hi! I have a small project where I extract a file and use this node to look up all the extracted files. Now when I use file pattern . it will not pick up filenames without an extension. Now when I change the file pattern to "*", it does not detect them as well, which not ideal on a linux system and to get an accurate number of files in a folder. Is there another way to create the pattern or something wrong with the logic of the node?

Thanks! Chris :)

ChrisFromMcAfee commented 3 years ago

I just went through the code and found this

if ( (node.pattern == '') || (node.pattern == '*') ) node.pattern = '*.*'

for the file-lister. I guess that explains why setting it to "" automatically is reset to .*. Is there a specific reason for that?

(sorry, I am a github newb, so please excuse my lack of formatting)

softy2k commented 3 years ago

Same issue for me : Files without extension are not listed

Info :

TotallyInformation commented 3 years ago

I'm sure there was an original reason for that code but I don't remember why now. Did you try amending the code manually?

jmorris644 commented 2 years ago

I modified the code to read

if (node.pattern == '') node.pattern = '*'

It works fine now.