From 03620a0c43a4240c33eff3b8ad3326dff3cc9055 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 10 Sep 2016 10:41:18 +0200 Subject: [PATCH] =?utf8?q?Remove=20=E2=80=9CforceDownload=E2=80=9D=20from?= =?utf8?q?=20image=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/template/ImageLinkFilter.java | 3 +-- .../java/net/pterodactylus/sone/template/ImageLinkFilterTest.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/template/ImageLinkFilter.java b/src/main/java/net/pterodactylus/sone/template/ImageLinkFilter.java index 2f1526f..511baf8 100644 --- a/src/main/java/net/pterodactylus/sone/template/ImageLinkFilter.java +++ b/src/main/java/net/pterodactylus/sone/template/ImageLinkFilter.java @@ -45,7 +45,7 @@ import com.google.common.base.Optional; public class ImageLinkFilter implements Filter { /** The template to render for the <img> tag. */ - private static final Template linkTemplate = TemplateParser.parse(new StringReader(" class=\"<%class|css>\"<%/if> src=\"<%src|html><%if forceDownload>?forcedownload=true<%/if>\" alt=\"<%alt|html>\" title=\"<%title|html>\" width=\"<%width|html>\" height=\"<%height|html>\" style=\"position: relative;<%ifnull ! top>top: <% top|html>;<%/if><%ifnull ! left>left: <% left|html>;<%/if>\"/>")); + private static final Template linkTemplate = TemplateParser.parse(new StringReader(" class=\"<%class|css>\"<%/if> src=\"<%src|html>\" alt=\"<%alt|html>\" title=\"<%title|html>\" width=\"<%width|html>\" height=\"<%height|html>\" style=\"position: relative;<%ifnull ! top>top: <% top|html>;<%/if><%ifnull ! left>left: <% left|html>;<%/if>\"/>")); /** The core. */ private final Core core; @@ -90,7 +90,6 @@ public class ImageLinkFilter implements Filter { linkTemplateContext.set("class", imageClass); if (image.isInserted()) { linkTemplateContext.set("src", "/" + image.getKey()); - linkTemplateContext.set("forceDownload", true); } else { linkTemplateContext.set("src", "getImage.html?image=" + image.getId()); } diff --git a/src/test/java/net/pterodactylus/sone/template/ImageLinkFilterTest.java b/src/test/java/net/pterodactylus/sone/template/ImageLinkFilterTest.java index 20d2362..e96b6cb 100644 --- a/src/test/java/net/pterodactylus/sone/template/ImageLinkFilterTest.java +++ b/src/test/java/net/pterodactylus/sone/template/ImageLinkFilterTest.java @@ -73,7 +73,7 @@ public class ImageLinkFilterTest { String result = String.valueOf(imageLinkFilter.format(templateContext, image, ImmutableMap.of())); Element imageElement = getSingleElement(result); assertThat(imageElement.attr("class"), is("")); - assertThat(imageElement.attr("src"), is("/image-key?forcedownload=true")); + assertThat(imageElement.attr("src"), is("/image-key")); assertThat(imageElement.attr("title"), is("image title")); assertThat(imageElement.attr("alt"), is("image description")); assertThat(imageElement.attr("width"), is("640")); @@ -138,7 +138,7 @@ public class ImageLinkFilterTest { String result = String.valueOf(imageLinkFilter.format(templateContext, "image-id", ImmutableMap.of())); Element imageElement = getSingleElement(result); assertThat(imageElement.attr("class"), is("")); - assertThat(imageElement.attr("src"), is("/image-key?forcedownload=true")); + assertThat(imageElement.attr("src"), is("/image-key")); assertThat(imageElement.attr("title"), is("image title")); assertThat(imageElement.attr("alt"), is("image description")); assertThat(imageElement.attr("width"), is("640")); -- 2.7.4