File tree 1 file changed +8
-5
lines changed
src/main/groovy/com/wizpanda/file/api
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import groovy.util.logging.Slf4j
5
5
import org.jclouds.aws.s3.blobstore.options.AWSS3PutObjectOptions
6
6
import org.jclouds.s3.domain.S3Object
7
7
import org.jclouds.s3.domain.internal.MutableObjectMetadataImpl
8
- import org.jclouds.s3.domain.internal.S3ObjectImpl
9
8
10
9
@Slf4j
11
10
class AmazonS3PermanentURLApi extends AmazonS3Api {
@@ -21,14 +20,18 @@ class AmazonS3PermanentURLApi extends AmazonS3Api {
21
20
String fileName = getFileName(this . rawFile)
22
21
String containerName = getContainerName()
23
22
24
- MutableObjectMetadataImpl mutableObjectMetadata = new MutableObjectMetadataImpl ()
23
+ S3Object s3Object = client. newS3Object()
24
+ s3Object. setPayload(this . rawFile)
25
+
26
+ MutableObjectMetadataImpl mutableObjectMetadata = s3Object. getMetadata()
25
27
mutableObjectMetadata. setKey(fileName)
26
28
setCacheControl(mutableObjectMetadata)
29
+ /**
30
+ * Always set the content-type after setting the payload so that it does not get overridden.
31
+ * https://groups.google.com/d/msg/jclouds/FMuEbPo9M_k/kaXCKkuOKdMJ
32
+ */
27
33
setContentType(mutableObjectMetadata)
28
34
29
- S3Object s3Object = new S3ObjectImpl (mutableObjectMetadata)
30
- s3Object. setPayload(this . rawFile)
31
-
32
35
AWSS3PutObjectOptions fileOptions = new AWSS3PutObjectOptions ()
33
36
setAccessPolicy(fileOptions)
34
37
You can’t perform that action at this time.
0 commit comments