Files
i2p.i2p/apps/syndie/jsp/viewtempattachment.jsp
jrandom ef7d1ba964 2005-09-27 jrandom
* Properly suggest filenames for attachments in Syndie (thanks all!)
    * Fixed the Syndie authorization scheme for single user vs. multiuser
2005-09-27 22:42:49 +00:00

23 lines
1.0 KiB
Plaintext

<%@page import="net.i2p.syndie.web.ArchiveViewerBean" %><jsp:useBean
scope="session" class="net.i2p.syndie.web.PostBean" id="post" /><%
request.setCharacterEncoding("UTF-8");
java.util.Map params = request.getParameterMap();
String id = request.getParameter(ArchiveViewerBean.PARAM_ATTACHMENT);
if (id != null) {
try {
int attachmentId = Integer.parseInt(id);
if ( (attachmentId < 0) || (attachmentId >= post.getAttachmentCount()) ) {
%>Attachment <%=attachmentId%> does not exist<%
} else {
response.setContentType(post.getContentType(attachmentId));
boolean inline = ArchiveViewerBean.getAttachmentShouldShowInline(params);
String filename = ArchiveViewerBean.getAttachmentFilename(params);
if (inline)
response.setHeader("Content-Disposition", "inline; filename=" + filename);
else
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
post.writeAttachmentData(attachmentId, response.getOutputStream());
}
} catch (NumberFormatException nfe) {}
}
%>