diff --git a/src/main/java/com/google/glassware/NotifyServlet.java b/src/main/java/com/google/glassware/NotifyServlet.java index cf96c29..742be11 100644 --- a/src/main/java/com/google/glassware/NotifyServlet.java +++ b/src/main/java/com/google/glassware/NotifyServlet.java @@ -71,8 +71,9 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // Count the lines as a very basic way to prevent Denial of Service attacks int lines = 0; - while (notificationReader.ready()) { - notificationString += notificationReader.readLine(); + String line; + while ((line = notificationReader.readLine()) != null) { + notificationString += line; lines++; // No notification would ever be this long. Something is very wrong. @@ -80,6 +81,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) throw new IOException("Attempted to parse notification payload that was unexpectedly long."); } } + notificationReader.close(); LOG.info("got raw notification " + notificationString); diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index d42b30c..4f3817f 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -109,9 +109,12 @@ limitations under the License. <% if (timelineItem.getAttachments() != null) { for (Attachment attachment : timelineItem.getAttachments()) { - if (MirrorClient.getAttachmentContentType(credential, timelineItem.getId(), attachment.getId()).startsWith("")) { %> - + if (MirrorClient.getAttachmentContentType(credential, timelineItem.getId(), attachment.getId()).startsWith("image")) { %> + + + <% } else { %>