fix attachments download with already set url

pull/1387/head
Audric Ackermann 5 years ago
parent bcc54f2bd0
commit 7c47150194
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1,19 +1,16 @@
import React from 'react'; import React from 'react';
import { LocalizerType } from '../../types/Util';
interface Props { interface Props {
i18n: LocalizerType;
sessionResetMessageKey: string; sessionResetMessageKey: string;
} }
export class ResetSessionNotification extends React.Component<Props> { export class ResetSessionNotification extends React.Component<Props> {
public render() { public render() {
const { i18n, sessionResetMessageKey } = this.props; const { sessionResetMessageKey } = this.props;
return ( return (
<div className="module-reset-session-notification"> <div className="module-reset-session-notification">
{i18n(sessionResetMessageKey)} {window.i18n(sessionResetMessageKey)}
</div> </div>
); );
} }

@ -327,7 +327,6 @@ export const save = ({
attachment, attachment,
document, document,
index, index,
getAbsolutePath,
timestamp, timestamp,
}: { }: {
attachment: AttachmentType; attachment: AttachmentType;
@ -337,11 +336,10 @@ export const save = ({
timestamp?: number; timestamp?: number;
}): void => { }): void => {
const isObjectURLRequired = is.undefined(attachment.fileName); const isObjectURLRequired = is.undefined(attachment.fileName);
const url = getAbsolutePath(attachment.fileName);
const filename = getSuggestedFilename({ attachment, timestamp, index }); const filename = getSuggestedFilename({ attachment, timestamp, index });
saveURLAsFile({ url, filename, document }); saveURLAsFile({ url: attachment.url, filename, document });
if (isObjectURLRequired) { if (isObjectURLRequired) {
URL.revokeObjectURL(url); URL.revokeObjectURL(attachment.url);
} }
}; };

Loading…
Cancel
Save