From: David ‘Bombe’ Roden Date: Sat, 10 Sep 2016 08:41:18 +0000 (+0200) Subject: Remove “forceDownload” from image keys X-Git-Tag: 0.9.6^2~50 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=03620a0c43a4240c33eff3b8ad3326dff3cc9055;p=Sone.git Remove “forceDownload” from image keys --- 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"));