|
|
|
@ -41,7 +41,7 @@ type UploadPolicy struct {
|
|
|
|
|
Conditions []interface{} `json:"conditions"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//MetaData 文件信息
|
|
|
|
|
// MetaData 文件信息
|
|
|
|
|
type MetaData struct {
|
|
|
|
|
Size uint64
|
|
|
|
|
Etag string
|
|
|
|
@ -71,7 +71,7 @@ func (handler *Driver) InitS3Client() error {
|
|
|
|
|
Credentials: credentials.NewStaticCredentials(handler.Policy.AccessKey, handler.Policy.SecretKey, ""),
|
|
|
|
|
Endpoint: &handler.Policy.Server,
|
|
|
|
|
Region: &handler.Policy.OptionsSerialized.Region,
|
|
|
|
|
S3ForcePathStyle: aws.Bool(true),
|
|
|
|
|
S3ForcePathStyle: &handler.Policy.OptionsSerialized.S3ForcePathStyle,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
@ -289,17 +289,17 @@ func (handler *Driver) Source(
|
|
|
|
|
return "", err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contentDescription := aws.String("attachment; filename=\"" + url.PathEscape(fileName) + "\"")
|
|
|
|
|
if !isDownload {
|
|
|
|
|
contentDescription = nil
|
|
|
|
|
}
|
|
|
|
|
req, _ := handler.svc.GetObjectRequest(
|
|
|
|
|
&s3.GetObjectInput{
|
|
|
|
|
Bucket: &handler.Policy.BucketName,
|
|
|
|
|
Key: &path,
|
|
|
|
|
ResponseContentDisposition: aws.String("attachment; filename=\"" + url.PathEscape(fileName) + "\""),
|
|
|
|
|
ResponseContentDisposition: contentDescription,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if ttl == 0 {
|
|
|
|
|
ttl = 3600
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
signedURL, err := req.Presign(time.Duration(ttl) * time.Second)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
|