Skip to content

Commit 577c001

Browse files
Christie BakerChristie Baker
authored andcommitted
feat(upload-core): add extra metadata field
1 parent 3bbfe72 commit 577c001

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

packages/upload-core/upload.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,24 @@ class Upload {
117117
start() {
118118
const { file } = this;
119119

120+
const metadata = {
121+
'availity-filename': file.name,
122+
'availity-content-type': file.type,
123+
'availity-attachment-name': 'N/A',
124+
};
125+
if (this.options.metadata) {
126+
Object.assign(metadata, this.options.metadata);
127+
}
128+
120129
const upload = new tus.Upload(file, {
121130
resume: true,
122131
endpoint: `${this.options.endpoint}/${this.options.bucketId}/`,
123132
chunkSize: this.options.chunkSize,
124-
metadata: {
125-
'availity-filename': file.name,
126-
'availity-content-type': file.type,
127-
'availity-attachment-name': 'N/A',
128-
},
133+
metadata,
129134
headers: {
130135
'X-XSRF-TOKEN': this.getToken(),
131136
'X-Availity-Customer-ID': this.options.customerId,
132137
'X-Client-ID': this.options.clientId,
133-
'Availity-Filename': file.name,
134-
'Availity-Content-Type': file.type,
135138
},
136139
onError: err => {
137140
if (!this.isValidFile()) {
@@ -220,7 +223,7 @@ class Upload {
220223
const uploadResult = xhr.getResponseHeader('Upload-Result');
221224
const msg = xhr.getResponseHeader('Upload-Message');
222225
if (scanResult === 'rejected') {
223-
return { status: scanResult, message: msg || 'File scan failed' };
226+
return { status: scanResult, message: msg || 'Failed AV scan' };
224227
}
225228

226229
if (uploadResult === 'rejected') {

0 commit comments

Comments
 (0)