@noatgnu/cupcake-vanilla 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1805,17 +1805,16 @@ class ChunkedUploadService extends BaseApiService {
1805
1805
  * Complete the chunked upload by uploading the entire file at once
1806
1806
  */
1807
1807
  completeUploadWithFile(request) {
1808
- const formData = new FormData();
1809
- formData.append('file', request.file);
1810
- if (request.filename) {
1811
- formData.append('filename', request.filename);
1812
- }
1813
1808
  const hasher = new jsSHA('SHA-256', 'ARRAYBUFFER');
1814
1809
  const arrayBufferPromise = request.file.arrayBuffer();
1815
1810
  return from(arrayBufferPromise).pipe(switchMap((arrayBuffer) => {
1816
1811
  hasher.update(arrayBuffer);
1817
1812
  const hash = hasher.getHash('HEX');
1818
- formData.append('sha256', hash);
1813
+ const formData = new FormData();
1814
+ formData.append('file', request.file);
1815
+ if (request.filename) {
1816
+ formData.append('filename', request.filename);
1817
+ }
1819
1818
  if (request.uploadSessionId) {
1820
1819
  formData.append('upload_session_id', request.uploadSessionId);
1821
1820
  }
@@ -1828,6 +1827,7 @@ class ChunkedUploadService extends BaseApiService {
1828
1827
  if (request.replaceExisting !== undefined) {
1829
1828
  formData.append('replace_existing', request.replaceExisting.toString());
1830
1829
  }
1830
+ formData.append('sha256', hash);
1831
1831
  return this.post(`${this.apiUrl}/chunked-upload/`, formData);
1832
1832
  }));
1833
1833
  }