From 5a66a14226912ec873c039e6e681f837b0fde2e0 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Wed, 28 Feb 2018 14:04:36 -0500 Subject: Handle file checksumming errors --- activestorage/app/javascript/activestorage/direct_upload.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activestorage/app') diff --git a/activestorage/app/javascript/activestorage/direct_upload.js b/activestorage/app/javascript/activestorage/direct_upload.js index 7085e0a4ab..c2eedf289b 100644 --- a/activestorage/app/javascript/activestorage/direct_upload.js +++ b/activestorage/app/javascript/activestorage/direct_upload.js @@ -14,8 +14,14 @@ export class DirectUpload { create(callback) { FileChecksum.create(this.file, (error, checksum) => { + if (error) { + callback(error) + return + } + const blob = new BlobRecord(this.file, checksum, this.url) notify(this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr) + blob.create(error => { if (error) { callback(error) -- cgit v1.2.3