NIFI-693:

- Filename in Content-Disposition should be quoted.
This commit is contained in:
Matt Gilman 2015-06-17 08:52:17 -04:00
parent 69f04cbb86
commit a4d21e3cd6
4 changed files with 5 additions and 5 deletions

View File

@ -107,7 +107,7 @@ public class StandardNiFiContentAccess implements ContentAccess {
// get the file name
final String contentDisposition = responseHeaders.getFirst("Content-Disposition");
final String filename = StringUtils.substringAfterLast(contentDisposition, "filename=");
final String filename = StringUtils.substringBetween(contentDisposition, "filename=\"", "\"");
// get the content type
final String contentType = responseHeaders.getFirst("Content-Type");

View File

@ -362,7 +362,7 @@ public class ProvenanceResource extends ApplicationResource {
contentType = MediaType.APPLICATION_OCTET_STREAM;
}
return generateOkResponse(response).type(contentType).header("Content-Disposition", String.format("attachment; filename=%s", content.getFilename())).build();
return generateOkResponse(response).type(contentType).header("Content-Disposition", String.format("attachment; filename=\"%s\"", content.getFilename())).build();
}
/**
@ -461,7 +461,7 @@ public class ProvenanceResource extends ApplicationResource {
contentType = MediaType.APPLICATION_OCTET_STREAM;
}
return generateOkResponse(response).type(contentType).header("Content-Disposition", String.format("attachment; filename=%s", content.getFilename())).build();
return generateOkResponse(response).type(contentType).header("Content-Disposition", String.format("attachment; filename=\"%s\"", content.getFilename())).build();
}
/**

View File

@ -428,7 +428,7 @@ public class TemplateResource extends ApplicationResource {
}
// generate the response
return generateOkResponse(template).header("Content-Disposition", String.format("attachment; filename=%s.xml", attachmentName)).build();
return generateOkResponse(template).header("Content-Disposition", String.format("attachment; filename=\"%s.xml\"", attachmentName)).build();
}
/**

View File

@ -70,7 +70,7 @@ public class DownloadSvg extends HttpServlet {
}
response.setContentType("image/svg+xml");
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().print(svg);