Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No binary data returned in Read/Write Files from Disk #11618

Open
tautv opened this issue Nov 7, 2024 · 3 comments
Open

No binary data returned in Read/Write Files from Disk #11618

tautv opened this issue Nov 7, 2024 · 3 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@tautv
Copy link

tautv commented Nov 7, 2024

Bug Description

Read/Write Files from Disk node fails to return data if the filename (or directory/folder name) contains both "(" and ")".
Only affects Read part.
Write part works ok.

Read will work if only ) is present.
Read will work if only ( is present.
Read will not work if both ( and ) are present, either in Filename or Directory Name.

To Reproduce

  1. Create two files locally - "test1.txt" ; "test(1).txt"
  2. Create a Read/Write Files from Disk node (Operation: "Read File(s) From Disk")
  3. test1.txt returns 'data'; test(1).txt doesn't:

Without ( and ):
Screenshot 2024-11-07 at 10 12 52

With ( and ) in filename:
Screenshot 2024-11-07 at 10 12 58

With ( and ) in foldername:
Screenshot 2024-11-07 at 10 20 54

Expected behavior

Read should work with files and folder containing ( and ).

Operating System

MacOS - Sonoma 14.6.1

n8n Version

1.66.0

Node.js Version

v20.18.0

Database

SQLite (default)

Execution mode

main (default)

@tautv tautv changed the title No 'data' in Read/Write Files from Disk No binary data returned in Read/Write Files from Disk Nov 8, 2024
@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Nov 11, 2024
@Joffcom
Copy link
Member

Joffcom commented Nov 11, 2024

This is now in Linear and is being tracked as NODE-2010

@tautv
Copy link
Author

tautv commented Nov 13, 2024

I did a quick/dirty fix on my side:
packages/nodes-base/nodes/Files/ReadWriteFile/actions/read.operation.ts
fileSelector = fileSelector.replace(/([()])/g, '\\$1');

Was going to open PR, but can't get the pnpm test to run.

This solved my parentheses issue, but not sure if it breaks anything else.

@tautv
Copy link
Author

tautv commented Nov 13, 2024

Out of curiosity:

At least on macOS, it's possible to have folders/files with [ and ] characters as well, introducing an odd challange.

f.e. if you have two files "test2.txt" and "test[2].txt", the node will return two 'data', which makes sense since it matches the pattern.
Screenshot 2024-11-13 at 13 22 22

Is there's a way to avoid/skip globbing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants