Make sure it's a string before trying to do indexOf

This commit is contained in:
Chris Moyer
2017-03-07 09:59:55 -05:00
parent 8b36c892d5
commit a333c59f82

View File

@@ -313,7 +313,7 @@ export class FileUploader {
Object.keys(this.options.additionalParameter).forEach((key:string) => { Object.keys(this.options.additionalParameter).forEach((key:string) => {
let paramVal = this.options.additionalParameter[key]; let paramVal = this.options.additionalParameter[key];
// Allow an additional parameter to include the filename // Allow an additional parameter to include the filename
if (paramVal.indexOf('{{file_name}}') >= 0) { if (typeof paramVal === 'string' && paramVal.indexOf('{{file_name}}') >= 0) {
paramVal = paramVal.replace('{{file_name}}', item.file.name); paramVal = paramVal.replace('{{file_name}}', item.file.name);
} }
sendable.append(key, paramVal); sendable.append(key, paramVal);