Force unique filename when saving files from multi-attachment msg

* Force unique filename when saving files from multi-attachment msg

* Don't use attachment filenames if index is provided at all
This commit is contained in:
Scott Nonnenberg 2019-06-14 11:58:33 -07:00 committed by Ken Powers
parent e19067861e
commit 649544dfac

View file

@ -1,6 +1,6 @@
import is from '@sindresorhus/is';
import moment from 'moment';
import { padStart } from 'lodash';
import { isNumber, padStart } from 'lodash';
import * as MIME from './MIME';
import { arrayBufferToObjectURL } from '../util/arrayBufferToObjectURL';
@ -357,7 +357,7 @@ export const getSuggestedFilename = ({
timestamp?: number | Date;
index?: number;
}): string => {
if (attachment.fileName) {
if (!isNumber(index) && attachment.fileName) {
return attachment.fileName;
}