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

Force binary encoding for multipart file/buffer fields #405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mciasuen
Copy link

@mciasuen mciasuen commented May 9, 2022

Fixes #403

@machao
Copy link
Contributor

machao commented Oct 21, 2022

thirst for this pr

@@ -55,11 +55,11 @@ function generate_part(name, part, boundary, callback) {
if ((part.file || part.buffer) && part.content_type) {

var filename = part.filename ? part.filename : part.file ? basename(part.file) : name;
if (part.buffer) return append(part.buffer, filename);
if (part.buffer) return append(part.buffer, filename, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

to keep compatibility, this action may be controlled by parameters

post(
    "server/url",
    {
        file: {  buffer, filename, content_type, force_binary }
    },
    {
         multipart: true
    }
)

@tomas
Copy link
Owner

tomas commented Nov 17, 2022

Yikes, totally forgot about this. Looks a-ok!

Would you add a quick test to make sure the result we get is the expected one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mangled file content when multipart-POSTing a file with a "text/*" content type
3 participants