Remove “forceDownload” from image keys
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 10 Sep 2016 08:41:18 +0000 (10:41 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 10 Sep 2016 08:44:34 +0000 (10:44 +0200)
src/main/java/net/pterodactylus/sone/template/ImageLinkFilter.java
src/test/java/net/pterodactylus/sone/template/ImageLinkFilterTest.java

index 2f1526f..511baf8 100644 (file)
@@ -45,7 +45,7 @@ import com.google.common.base.Optional;
 public class ImageLinkFilter implements Filter {
 
        /** The template to render for the &lt;img&gt; tag. */
-       private static final Template linkTemplate = TemplateParser.parse(new StringReader("<img<%ifnull !class> 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("<img<%ifnull !class> 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());
                }
index 20d2362..e96b6cb 100644 (file)
@@ -73,7 +73,7 @@ public class ImageLinkFilterTest {
                String result = String.valueOf(imageLinkFilter.format(templateContext, image, ImmutableMap.<String, Object>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.<String, Object>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"));