mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3027:Object_Store_Refactor - Uploaded template S3
content-type is not appropriate
This commit is contained in:
parent
bd84005b4e
commit
f0ebb0596d
|
|
@ -209,6 +209,13 @@ public class S3TemplateDownloader implements TemplateDownloader {
|
|||
remoteSize = maxTemplateSizeInByte;
|
||||
}
|
||||
|
||||
// get content type
|
||||
String contentType = null;
|
||||
Header contentTypeHeader = request.getResponseHeader("Content-Type");
|
||||
if ( contentTypeHeader != null ){
|
||||
contentType = contentTypeHeader.getValue();
|
||||
}
|
||||
|
||||
InputStream in = !chunked ? new BufferedInputStream(request.getResponseBodyAsStream())
|
||||
: new ChunkedInputStream(request.getResponseBodyAsStream());
|
||||
|
||||
|
|
@ -225,6 +232,9 @@ public class S3TemplateDownloader implements TemplateDownloader {
|
|||
// download using S3 API
|
||||
ObjectMetadata metadata = new ObjectMetadata();
|
||||
metadata.setContentLength(remoteSize);
|
||||
if ( contentType != null ){
|
||||
metadata.setContentType(contentType);
|
||||
}
|
||||
PutObjectRequest putObjectRequest = new PutObjectRequest(s3.getBucketName(), s3Key, in, metadata);
|
||||
// check if RRS is enabled
|
||||
if (s3.getEnableRRS()){
|
||||
|
|
|
|||
Loading…
Reference in New Issue