From 784f80f16ae5b7ccef965ab4c7e9fd848843b560 Mon Sep 17 00:00:00 2001 From: Addison Schiller Date: Fri, 18 Aug 2017 14:58:21 -0400 Subject: [PATCH] Links in pdfs should no longer open in the iframe. Instead, they should open in a new tab/window Changing test to match pdf template change/fix --- mfr/extensions/pdf/templates/viewer.mako | 2 +- mfr/server/static/js/mfr.js | 2 +- tests/extensions/pdf/test_renderer.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mfr/extensions/pdf/templates/viewer.mako b/mfr/extensions/pdf/templates/viewer.mako index b2f23a6d5..1e3b3ed08 100644 --- a/mfr/extensions/pdf/templates/viewer.mako +++ b/mfr/extensions/pdf/templates/viewer.mako @@ -19,7 +19,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/ --> - + diff --git a/mfr/server/static/js/mfr.js b/mfr/server/static/js/mfr.js index 3b2fdb649..86a329557 100644 --- a/mfr/server/static/js/mfr.js +++ b/mfr/server/static/js/mfr.js @@ -80,7 +80,7 @@ self.pymParent.iframe.setAttribute('allowfullscreen', ''); self.pymParent.iframe.setAttribute('webkitallowfullscreen', ''); self.pymParent.iframe.setAttribute('scrolling', 'yes'); - self.pymParent.iframe.setAttribute('sandbox', 'allow-scripts'); + self.pymParent.iframe.setAttribute('sandbox', 'allow-scripts allow-popups'); self.pymParent.el.appendChild(self.spinner); $(self.pymParent.iframe).on('load', function () { diff --git a/tests/extensions/pdf/test_renderer.py b/tests/extensions/pdf/test_renderer.py index bf1f8eb59..9b79abf11 100644 --- a/tests/extensions/pdf/test_renderer.py +++ b/tests/extensions/pdf/test_renderer.py @@ -39,6 +39,6 @@ class TestPdfRenderer: def test_render_pdf(self, renderer, metadata, assets_url): body = renderer.render() - assert ''.format(assets_url, 'pdf') in body + assert ''.format(assets_url, 'pdf') in body assert '
' in body assert 'DEFAULT_URL = \'{}\''.format(metadata.download_url) in body