Revision 9880
Added by Jing Tao over 8 years ago
src/edu/ucsb/nceas/metacat/restservice/v1/MNResourceHandler.java | ||
---|---|---|
1120 | 1120 |
filename = id.getValue() + extension; |
1121 | 1121 |
} |
1122 | 1122 |
response.setContentType(mimeType); |
1123 |
response.setHeader("Content-Disposition", "inline; filename=" + filename);
|
|
1123 |
response.setHeader("Content-Disposition", "inline; filename=\"" + filename+"\"");
|
|
1124 | 1124 |
out = response.getOutputStream(); |
1125 | 1125 |
IOUtils.copyLarge(data, out); |
1126 | 1126 |
|
... | ... | |
1234 | 1234 |
} else { |
1235 | 1235 |
filename = "dataPackage-" + System.currentTimeMillis() + ".zip"; |
1236 | 1236 |
} |
1237 |
response.setHeader("Content-Disposition", "inline; filename=" + filename);
|
|
1237 |
response.setHeader("Content-Disposition", "inline; filename=\"" + filename+"\"");
|
|
1238 | 1238 |
response.setContentType("application/zip"); |
1239 | 1239 |
response.setStatus(200); |
1240 | 1240 |
OutputStream out = response.getOutputStream(); |
src/edu/ucsb/nceas/metacat/restservice/v2/MNResourceHandler.java | ||
---|---|---|
1278 | 1278 |
} |
1279 | 1279 |
} |
1280 | 1280 |
response.setContentType(mimeType); |
1281 |
response.setHeader("Content-Disposition", "inline; filename=" + filename);
|
|
1281 |
response.setHeader("Content-Disposition", "inline; filename=\"" + filename+"\"");
|
|
1282 | 1282 |
|
1283 | 1283 |
InputStream data = MNodeService.getInstance(request).get(session, id); |
1284 | 1284 |
|
... | ... | |
1406 | 1406 |
} else { |
1407 | 1407 |
filename = "dataPackage-" + System.currentTimeMillis() + ".zip"; |
1408 | 1408 |
} |
1409 |
response.setHeader("Content-Disposition", "inline; filename=" + filename);
|
|
1409 |
response.setHeader("Content-Disposition", "inline; filename=\"" + filename+"\"");
|
|
1410 | 1410 |
response.setContentType("application/zip"); |
1411 | 1411 |
response.setStatus(200); |
1412 | 1412 |
OutputStream out = response.getOutputStream(); |
Also available in: Unified diff
Added the double quotes on the file name of the http header "content-deposition". This can handle the special characters on the file name.
https://projects.ecoinformatics.org/ecoinfo/issues/7084