From 0e65d54af298399bb1a2b70a0c1211e3648391b2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 3 Mar 2020 11:03:40 +0000 Subject: [PATCH] Fix having to decrypt & download in two steps --- src/components/views/messages/MFileBody.js | 4 +++- src/usercontent/index.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/views/messages/MFileBody.js b/src/components/views/messages/MFileBody.js index 886afbb666..312346f412 100644 --- a/src/components/views/messages/MFileBody.js +++ b/src/components/views/messages/MFileBody.js @@ -247,6 +247,8 @@ export default createReactClass({ }); }; + // This button should actually Download because usercontent/ will try to click itself + // but it is not guaranteed between various browsers' settings. return (
@@ -290,7 +292,7 @@ export default createReactClass({ src={`${url}?origin=${encodeURIComponent(window.location.origin)}`} onLoad={onIframeLoad} ref={this._iframe} - sandbox="allow-scripts allow-downloads" /> + sandbox="allow-scripts allow-downloads allow-downloads-without-user-activation" />
); diff --git a/src/usercontent/index.js b/src/usercontent/index.js index 08769d6bd1..47eb83964f 100644 --- a/src/usercontent/index.js +++ b/src/usercontent/index.js @@ -27,6 +27,7 @@ function remoteRender(event) { // Don't display scrollbars if the link takes more than one line to display. body.style = "margin: 0px; overflow: hidden"; body.appendChild(a); + a.click(); // try to trigger download automatically } function remoteSetTint(event) {