GithubHelp home page GithubHelp logo

.replaceAll doing weird stuff about n8n HOT 8 CLOSED

Nahiiko avatar Nahiiko commented on June 3, 2024
.replaceAll doing weird stuff

from n8n.

Comments (8)

Nahiiko avatar Nahiiko commented on June 3, 2024 1

Interesting ! indeed I didn't take the time to dig deeper and try other replacement strings, seems you're right. What a coincidence !

I think it'd make more sense to trim the space, but I guess that's just a dev choice not a bug, guess we can close.

thanks for the support!

from n8n.

Joffcom avatar Joffcom commented on June 3, 2024

Hey @Nahiiko

In the example you provided do you actually have an extra space at the end of the file extension or is that just a typo?

What is the actual value of json.Projects?

from n8n.

Nahiiko avatar Nahiiko commented on June 3, 2024

Hi @Joffcom

Yeah there is a space at the end, which is getting replaced by the underscore once you download the file (weirdly not on the UI), which is exactly the issue here.

json.Projects doesn't matter here, as you can see in my reproduction, it works with '{{hello world}}.xlsx '-> hello_world.xlsx_

from n8n.

mbrother2 avatar mbrother2 commented on June 3, 2024

Hi @Nahiiko

Seem your issue is related to your OS, Mime Type of your xlsx file is 'application/x-cfb'. This is on my server, file name works normally:
n8n-convert-to-file

My server:
OS: Debian 11, n8n 1.23.0 with docker

from n8n.

Nahiiko avatar Nahiiko commented on June 3, 2024

I'm running n8n inside docker on a synology NAS so I don't think that's the issue but here's the stack:
postgres:15.4
n8nio/n8n:latest

Now that I think of it, I do run with "N8N_DEFAULT_BINARY_DATA_MODE: filesystem" enabled, could that be the differentiator here ?

from n8n.

Joffcom avatar Joffcom commented on June 3, 2024

I don't think filesystem should matter, I do however still need to create a file with a space at the end of the extension to see what happens although that seems like it would cause other issues as it shouldn't be there anyway.

I will see if I can reproduce this now.

from n8n.

Joffcom avatar Joffcom commented on June 3, 2024

Alright I have given this a test and the replaceAll() appears to have nothing to do with this, If you just have a space at the end of a filename we will add the _ to it instead of a space. This is likely because a trailing space in a filename will cause issues with some operating systems (Windows).

Based on this I believe this is protecting some users and there is actually no bug here as the alternative would be to remove the space from the end or refuse to download the file and throw an error.

What do you think @Nahiiko?

from n8n.

Joffcom avatar Joffcom commented on June 3, 2024

Hey @Nahiiko,

I think for now we can move this to closed and we can chat internally and look at what other projects do to handle it.

from n8n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.