serviejs/popsicle

Uploading files with filenames containing special characters

Closed this issue · 5 comments

Hello, we use popsicle for uploading files like this:

const form = popsicle.form({
  ...someDataAboutFileUploadContext,
  fileInput // uploading file
});

const request = popsicle
  .post({
    url,
    body: form,
    transport: popsicle.createTransport({
      withCredentials: true
    })
  })
  .use(popsicle.plugins.parse('json'));

And it works great, but it fails for files with name containing this characters: , ; " ' (comma, semicolon, double quote, single quote). Can you help me to solve this?

Is this from a browser or node.js? It looks like browser since withCredentials, and in which case what is fileInput?

This is from browser, and fileInput is file selected by user. For selecting files we use Dropzone from 'react-dropzone', looks like this :) :
file

If it's browser based I don't think I can do anything to help you and I'm unsure why it would fail. The method just returns a native FormData object so everything is outside of this library. Let me know if your seeing something different to what I'm describing though.

@rustemkk If you do find out what's going on, please post it here! I'd definitely love to hear if you find out what's happening, I've not seen it before but I tend to use this more server-side than in browsers.

@blakeembrey So sorry for wasting your time.. Turns up it was backend validation on filename. Thank you!