Mulen
June 17, 2024, 1:37pm
1
Hello.
Latest Version of n8n with PostgreSQL.
I try to upload a file with non latin characters by using HTTP node to a Wordpress site and it throws an error.
Invalid character in header content ["content-disposition"]
When i do the same POST request via Postman with non latin characters it works.
Is there any workaround?
n8n
June 17, 2024, 1:37pm
2
It looks like your topic is missing some important information. Could you provide the following if applicable.
n8n version:
Database (default: SQLite):
n8n EXECUTIONS_PROCESS setting (default: own, main):
Running n8n via (Docker, npm, n8n cloud, desktop app):
Operating system:
aya
June 17, 2024, 4:04pm
3
Hi @Mulen ,
I think you’re right that the non latin characters are causing the issue here. To fix this, you can try using the encodeURIComponent()
function to encode your filename.
{{ encodeURIComponent("Δοκιμαστικό Κείμενο.tiff") }}
This will convert the non-Latin characters into a format that’s safe for HTTP headers which should prevent the error. Give it a try!
Here is a similar question from the past: Encode URI Component help
Mulen
June 18, 2024, 6:24am
5
Hey aya. Thanks it works but the name in the media library is shown like this
This is not desireable
Mulen
June 18, 2024, 6:26am
6
It does not work with non-latin characters. Same problem.
Invalid character in header content ["content-disposition"]
Mulen
June 18, 2024, 6:38am
7
I tried with Postman as i said and another workflow tool, Make.com and you can upload a file to media library with non-latin characters just fine. I think something with the HTTP node is happening.
barn4k
June 18, 2024, 8:18am
8
try this one
attachment; filename*=UTF-8''{{encodeURIComponent("Δοκιμαστικό Κείμενο.tiff")}}
It’s not actually an issue with the HTTP node, as it acts according to the RFC and you are not allowed to use non-ASCII symbols in the Content-Disposition field
1 Like
Mulen
June 18, 2024, 8:35am
9
Hey @barn4k
Just tried it but still the node throws another error.
{"code":"rest_upload_invalid_disposition","message":"\u0394\u03b5\u03bd \u03c0\u03b1\u03c1\u03ad\u03c7\u03b5\u03c4\u03b1\u03b9 \u03ad\u03b3\u03ba\u03c5\u03c1\u03b7 \u0394\u03b9\u03ac\u03b8\u03b5\u03c3\u03b7 \u03a0\u03b5\u03c1\u03b9\u03b5\u03c7\u03bf\u03bc\u03ad\u03bd\u03bf\u03c5. \u0397 \u0394\u03b9\u03ac\u03b8\u03b5\u03c3\u03b7 \u03a0\u03b5\u03c1\u03b9\u03b5\u03c7\u03bf\u03bc\u03ad\u03bd\u03bf\u03c5 \u03c7\u03c1\u03b5\u03b9\u03ac\u03b6\u03b5\u03c4\u03b1\u03b9 \u03bd\u03b1 \u03b5\u03af\u03bd\u03b1\u03b9 \u03bc\u03bf\u03c1\u03c6\u03bf\u03c0\u03bf\u03b9\u03b7\u03bc\u03ad\u03bd\u03b7 \u03c9\u03c2 \u03c3\u03c5\u03bd\u03b7\u03bc\u03bc\u03ad\u03bd\u03bf; \u03cc\u03bd\u03bf\u03bc\u03b1 \u03b1\u03c1\u03c7\u03b5\u03af\u03bf\u03c5=\"\u03b1\u03c1\u03c7\u03b5\u03af\u03bf.png\".","data":{"status":400}}
Which translates to
{
"code": "rest_upload_invalid_disposition",
"message": "Δεν παρέχεται έγκυρη Διάθεση Περιεχομένου. Η Διάθεση Περιεχομένου χρειάζεται να είναι μορφοποιημένη ως συννημένο; όνομα αρχείου=\"αρχείο.png\".",
"data": {
"status": 400
}
}
In English
"No valid Content-Disposition provided. The Content-Disposition needs to be formatted as an attachment; filename="file.png"."
This is the flow (url is not real)
barn4k
June 18, 2024, 7:07pm
10
Well, I don’t see the original error Invalid character in header content ["content-disposition"]
is from the Axios library, so maybe guys could change the HTTP Node behavior
Mulen
June 18, 2024, 7:27pm
11
So is this some kind of bug in HTTP Node? Sorry for my ignorance.
Mulen
June 27, 2024, 7:30am
12
Is this aknowledged or am i doing something wrong?
Mulen
June 27, 2024, 8:48am
13
I believe it’s something with n8n HTTP node. I tried with Insomnia Client (Postman alternative) and it works fine.
n8n workflow:
Insomnia POST request:
curl --request POST \
--url https://www.mywebsite.com/wp-json/wp/v2/media \
--header 'Authorization: Basic MyCredsBase64Encoded==' \
--header 'Content-Disposition: =attachment; filename=\"Δοκιμαστικό Κείμενο.csv\"' \
--header 'Content-Type: text/csv' \
--data dGVzdA==
Upload Result:
system
Closed
September 25, 2024, 8:48am
14
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.