Revision 10054
Added by Jing Tao almost 8 years ago
src/edu/ucsb/nceas/metacat/restservice/v1/CNResourceHandler.java | ||
---|---|---|
556 | 556 |
} |
557 | 557 |
String extension = ObjectFormatInfo.instance().getExtension(sm.getFormatId().getValue()); |
558 | 558 |
String filename = id.getValue(); |
559 |
if (extension != null) { |
|
559 |
if (extension != null && filename != null && !filename.endsWith(extension)) {
|
|
560 | 560 |
filename = id.getValue() + extension; |
561 | 561 |
} |
562 | 562 |
response.setContentType(mimeType); |
src/edu/ucsb/nceas/metacat/restservice/v1/MNResourceHandler.java | ||
---|---|---|
1116 | 1116 |
} |
1117 | 1117 |
String extension = ObjectFormatInfo.instance().getExtension(sm.getFormatId().getValue()); |
1118 | 1118 |
String filename = id.getValue(); |
1119 |
if (extension != null) { |
|
1119 |
if (extension != null && filename != null && !filename.endsWith(extension)) {
|
|
1120 | 1120 |
filename = id.getValue() + extension; |
1121 | 1121 |
} |
1122 | 1122 |
response.setContentType(mimeType); |
src/edu/ucsb/nceas/metacat/restservice/v2/CNResourceHandler.java | ||
---|---|---|
605 | 605 |
if(filename == null || filename.trim().equals("")) { |
606 | 606 |
filename = id.getValue(); |
607 | 607 |
String extension = ObjectFormatInfo.instance().getExtension(sm.getFormatId().getValue()); |
608 |
if (extension != null) { |
|
608 |
if (extension != null && filename != null && !filename.endsWith(extension)) {
|
|
609 | 609 |
filename = id.getValue() + extension; |
610 | 610 |
} |
611 | 611 |
} |
src/edu/ucsb/nceas/metacat/restservice/v2/MNResourceHandler.java | ||
---|---|---|
1273 | 1273 |
extension = ObjectFormatInfo.instance().getExtension(sm.getFormatId().getValue()); |
1274 | 1274 |
} |
1275 | 1275 |
filename = id.getValue(); |
1276 |
if (extension != null) { |
|
1276 |
if (extension != null && filename != null && !filename.endsWith(extension)) {
|
|
1277 | 1277 |
filename = id.getValue() + "." + extension; |
1278 | 1278 |
} |
1279 | 1279 |
} |
Also available in: Unified diff
Add a smart test when we set the file name for the header of "content-deposition":
When the id doesn't end with the file extention, we set the file to be id+extension.