filepond icon indicating copy to clipboard operation
filepond copied to clipboard

Process chunks in the case of failure

Open meness opened this issue 4 years ago • 3 comments

Docs say if chunks failed, the client requests HEAD and the server must return Upload-Offset: <offset>, then the client mark lower chunks as completed, but in my case, the client starts from 0 once again while I send the header with a right offset.

React

<FilePond
          imageCropAspectRatio="1:1"
          stylePanelLayout="compact circle"
          maxFileSize="5MB"
          instantUpload={false}
          chunkUploads
          chunkForce
          chunkSize={500000}
          styleLoadIndicatorPosition="center bottom"
          acceptedFileTypes={['image/jpeg', 'image/png', 'image/webp']}
          styleButtonRemoveItemPosition="center bottom"
        />

Express

res.setHeader('Upload-Offset', offset);
  res.send();

My test is: I write 500000 bytes then throw an error. When the client requests a HEAD I tell it the offset is 500000, but it starts from 0.

I use the latest version.

meness avatar May 06 '20 22:05 meness

I don't have time to test this right now, so if you have any ideas what could be causing the issue that would be very helpful

rikschennink avatar May 12 '20 08:05 rikschennink

@meness Did you find a workaround or a solution to your problem? I'm currently facing the same problem, with the only difference being, that I'm using the VUE-Adapter instead of React.

BuchholzTim avatar Oct 16 '20 08:10 BuchholzTim

So I debugged it today to see what exactly is happening and filepond is in fact working correctly.

In my case it was an error caused by ExpressJS in the backend, because I didn't set: res.set('Access-Control-Expose-Headers', 'Upload-Offset');

Filepond received null, when trying to read the response header by xhr.getResponseHeader("Upload-Offset") and defaulted to using 0 as Offset.

BuchholzTim avatar Oct 18 '20 09:10 BuchholzTim