Skip to content

Commit

Permalink
feat(upload-core): add extra metadata field
Browse files Browse the repository at this point in the history
  • Loading branch information
Christie Baker authored and Christie Baker committed Apr 9, 2018
1 parent 3bbfe72 commit 577c001
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/upload-core/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,24 @@ class Upload {
start() {
const { file } = this;

const metadata = {
'availity-filename': file.name,
'availity-content-type': file.type,
'availity-attachment-name': 'N/A',
};
if (this.options.metadata) {
Object.assign(metadata, this.options.metadata);
}

const upload = new tus.Upload(file, {
resume: true,
endpoint: `${this.options.endpoint}/${this.options.bucketId}/`,
chunkSize: this.options.chunkSize,
metadata: {
'availity-filename': file.name,
'availity-content-type': file.type,
'availity-attachment-name': 'N/A',
},
metadata,
headers: {
'X-XSRF-TOKEN': this.getToken(),
'X-Availity-Customer-ID': this.options.customerId,
'X-Client-ID': this.options.clientId,
'Availity-Filename': file.name,
'Availity-Content-Type': file.type,
},
onError: err => {
if (!this.isValidFile()) {
Expand Down Expand Up @@ -220,7 +223,7 @@ class Upload {
const uploadResult = xhr.getResponseHeader('Upload-Result');
const msg = xhr.getResponseHeader('Upload-Message');
if (scanResult === 'rejected') {
return { status: scanResult, message: msg || 'File scan failed' };
return { status: scanResult, message: msg || 'Failed AV scan' };
}

if (uploadResult === 'rejected') {
Expand Down

0 comments on commit 577c001

Please sign in to comment.