Visitar URL original
lost character '/' when set filename string to formdata · Issue #570 · form-data/form-data · GitHub
Skip to content

lost character '/' when set filename string to formdata #570

Open

Description

@Jake001

Enviroment:
server,not browser;
nodejs@12.22,
"axios": "^1.7.7",
"form-data": "^4.0.0",

code:

var form = new FormData();
form.append( '/firmware.binS', , file.size );
form.append( 'myfile[]', fs.createReadStream('/firmware.bin'), '/firmware.bin' );
const config = {
  headers:{
    'Content-Type':'multipart/form-data',
  },
}
axios.post(url,form,config)
.then((r)=>{
})
.catch((error)=>{
})

problem:
the 1st '/firmwarebinS' is right, the 2nd '/firmware.bin' had been changed to 'firmware.bin'. The '/' is lost.

Activity

  1. ljharb commented on Nov 6, 2024

    @ljharb
    Member

    You have an omitted function argument in that code, so it can't run. Can you make a smaller repro that doesn't involve axios?

  2. Jake001 commented on Nov 6, 2024

    @Jake001
    Author

    You have an omitted function argument in that code, so it can't run. Can you make a smaller repro that doesn't involve axios?

    Sorry, As the HTTP cors, I can't.

  3. ljharb commented on Nov 6, 2024

    @ljharb
    Member

    Unfortunately if I can't reproduce it, then I'm not sure how I can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions