mirror of
https://github.com/apache/nifi.git
synced 2025-02-16 15:06:00 +00:00
NIFI-693:
- Filename in Content-Disposition should be quoted.
This commit is contained in:
parent
69f04cbb86
commit
a4d21e3cd6
@ -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");
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user