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

fix(core): equals sign breaks the "Import from cURL" functionality for HTTP node #9769

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

restyler
Copy link

@restyler restyler commented Jun 15, 2024

Summary

"Import from cURL" functionality for HTTP node is broken for some POSTed JSON data.
= sign is encoded incorrectly on JSON import due to outdated curlconverter dependency. I verified that newer curlconverter versions are working correctly. (I am new to n8n development so I apologize if I missed something in this PR)

Related Linear tickets, Github issues, and Community forum posts

#9768

Fix equal sign encoding in "Import from cURL" feature.

n8n-io#9768
@CLAassistant
Copy link

CLAassistant commented Jun 15, 2024

CLA assistant check
All committers have signed the CLA.

@restyler restyler changed the title Fix equals sign encoding in "Import from cURL" form fix(core): equals sign breaks the "Import from cURL" functionality for HTTP node Jun 15, 2024
@n8n-assistant n8n-assistant bot added community Authored by a community member core Enhancement outside /nodes-base and /editor-ui in linear Issue or PR has been created in Linear for internal review labels Jun 15, 2024
Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell curlconverter@4 is an ESM only package, and n8n can't use ESM right now.
To solve this we either need to update n8n, and all its dependencies to be ESM, or ask curlconverter to publish a package that works with CJS and ESM both.
The third option would be find the actual fix in curlconverter@4, back-port it to 3.x, send them a PR, ask them to publish a 3.x version, and then update that version here.

@ivov
Copy link
Contributor

ivov commented Jun 17, 2024

Tracking: https://linear.app/n8n/issue/PAY-1681

@restyler
Copy link
Author

restyler commented Jul 5, 2024

It turned out that the problem is in query-string package which is used in generators/json.js dependency of the curlconverter.
https://github.com/curlconverter/curlconverter/blob/v3.21.0/generators/json.js#L48

this is where the string gets corrupted.
The funny thing is that latest query-string@7 contains the error, and query-string@8 is ESM-only, pretty much like latest curlconverter.

I can get the latest version of this json generator from v4 branch:
https://github.com/curlconverter/curlconverter/blob/v4.10.1/src/generators/json.ts - and convert it to Javascript (since curlconverter@3 is JS, not TS) but this is definitely not a 3 or 5 line change - do you think this would make sense to back-port?

@netroy
Copy link
Member

netroy commented Jul 5, 2024

do you think this would make sense to back-port

Do you mean back-port the fix in curlconverter? I think that's the decision for the maintainers of curlconverter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member core Enhancement outside /nodes-base and /editor-ui in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants