cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [47/50] [abbrv] git commit: updated refs/heads/master to 97f8c52
Date Thu, 20 Jun 2013 07:20:20 GMT
CLOUDSTACK-3027:Object_Store_Refactor - Uploaded template S3
content-type is not appropriate

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f0ebb059
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f0ebb059
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f0ebb059

Branch: refs/heads/master
Commit: f0ebb0596dd26c7156e96ce2fedb25bca2af75f1
Parents: bd84005
Author: Min Chen <min.chen@citrix.com>
Authored: Wed Jun 19 16:50:27 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed Jun 19 16:50:27 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/storage/template/S3TemplateDownloader.java  | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0ebb059/core/src/com/cloud/storage/template/S3TemplateDownloader.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/template/S3TemplateDownloader.java b/core/src/com/cloud/storage/template/S3TemplateDownloader.java
index 7763423..340e0db 100644
--- a/core/src/com/cloud/storage/template/S3TemplateDownloader.java
+++ b/core/src/com/cloud/storage/template/S3TemplateDownloader.java
@@ -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()){


Mime
View raw message