From 649544dfac4af76986575ad7d4c6fac7463f6faf Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 14 Jun 2019 11:58:33 -0700 Subject: [PATCH] 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 --- ts/types/Attachment.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/types/Attachment.ts b/ts/types/Attachment.ts index 6a9c65359d..cffe1a7391 100644 --- a/ts/types/Attachment.ts +++ b/ts/types/Attachment.ts @@ -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; }