diff --git a/README.MD b/README.MD
index c25b0cf..5e3777f 100644
--- a/README.MD
+++ b/README.MD
@@ -1,3 +1,16 @@
+Version 3.24.6
+
+New Features:
+1. Supports passing metadata when use CopyObject and InitiateMultipartUpload mehod.
+
+Documentation & Demo:
+
+Resolved Issues:
+1. Fixed the issue where bucket acl configuration failed in some scenarios.
+2. Fixed the issue where data transmission exception in retry scenarios.
+
+-----------------------------------------------------------------------------------
+
Version 3.24.3
New Features:
diff --git a/README_CN.MD b/README_CN.MD
index 7af9417..a3937fa 100644
--- a/README_CN.MD
+++ b/README_CN.MD
@@ -1,3 +1,17 @@
+Version 3.24.6
+
+新特性:
+1. 支持在使用CopyObject和InitiateMultipartUpload方法时传递元数据信息。
+
+资料 & demo:
+
+修复问题:
+
+1. 修复部分场景下bucket acl配置失败的问题。
+2. 修复重试场景下数据传输异常的问题。
+
+-----------------------------------------------------------------------------------
+
Version 3.24.3
新特性:
diff --git a/obs/client_bucket.go b/obs/client_bucket.go
index d3c9f87..142e5fc 100644
--- a/obs/client_bucket.go
+++ b/obs/client_bucket.go
@@ -323,8 +323,9 @@ func (obsClient ObsClient) getBucketACLObs(bucketName string, extensions []exten
tempOutput.Grantee.DisplayName = valGrant.Grantee.DisplayName
tempOutput.Grantee.ID = valGrant.Grantee.ID
tempOutput.Grantee.Type = valGrant.Grantee.Type
- tempOutput.Grantee.URI = GroupAllUsers
-
+ if valGrant.Grantee.Canned == "Everyone" {
+ tempOutput.Grantee.URI = GroupAllUsers
+ }
output.Grants = append(output.Grants, tempOutput)
}
}
diff --git a/obs/client_part.go b/obs/client_part.go
index efca2e6..195f54b 100644
--- a/obs/client_part.go
+++ b/obs/client_part.go
@@ -151,6 +151,7 @@ func (obsClient ObsClient) UploadPart(_input *UploadPartInput, extensions ...ext
input.PartSize = fileSize - input.Offset
}
fileReaderWrapper.totalCount = input.PartSize
+ fileReaderWrapper.mark = input.Offset
if _, err = fd.Seek(input.Offset, io.SeekStart); err != nil {
return nil, err
}
diff --git a/obs/conf.go b/obs/conf.go
index b7d6d70..f5f3a9d 100644
--- a/obs/conf.go
+++ b/obs/conf.go
@@ -71,12 +71,14 @@ type config struct {
}
func (conf config) String() string {
- return fmt.Sprintf("[endpoint:%s, signature:%s, pathStyle:%v, region:%s"+
- "\nconnectTimeout:%d, socketTimeout:%dheaderTimeout:%d, idleConnTimeout:%d"+
- "\nmaxRetryCount:%d, maxConnsPerHost:%d, sslVerify:%v, maxRedirectCount:%d]",
+ return fmt.Sprintf("[endpoint:%s, signature:%s, pathStyle:%v, region:%s,"+
+ "\nconnectTimeout:%d, socketTimeout:%d, headerTimeout:%d, idleConnTimeout:%d,"+
+ "\nmaxRetryCount:%d, maxConnsPerHost:%d, sslVerify:%v, maxRedirectCount:%d,"+
+ "\ncname:%v, userAgent:%s, disableKeepAlive:%v, proxyFromEnv:%v]",
conf.endpoint, conf.signature, conf.pathStyle, conf.region,
conf.connectTimeout, conf.socketTimeout, conf.headerTimeout, conf.idleConnTimeout,
conf.maxRetryCount, conf.maxConnsPerHost, conf.sslVerify, conf.maxRedirectCount,
+ conf.cname, conf.userAgent, conf.disableKeepAlive, conf.proxyFromEnv,
)
}
diff --git a/obs/const.go b/obs/const.go
index d5872ff..8e98ec8 100644
--- a/obs/const.go
+++ b/obs/const.go
@@ -13,7 +13,7 @@
package obs
const (
- OBS_SDK_VERSION = "3.23.12"
+ OBS_SDK_VERSION = "3.24.6"
USER_AGENT = "obs-sdk-go/" + OBS_SDK_VERSION
HEADER_PREFIX = "x-amz-"
HEADER_PREFIX_META = "x-amz-meta-"
diff --git a/obs/convert.go b/obs/convert.go
index 81099a6..b0fbd93 100644
--- a/obs/convert.go
+++ b/obs/convert.go
@@ -95,19 +95,31 @@ func ParseStringToFSStatusType(value string) (ret FSStatusType) {
return
}
-func prepareGrantURI(grant Grant) string {
- if grant.Grantee.URI == GroupAllUsers || grant.Grantee.URI == GroupAuthenticatedUsers {
- return fmt.Sprintf("%s%s", "http://acs.amazonaws.com/groups/global/", grant.Grantee.URI)
+func prepareGrantURI(grantUri GroupUriType) string {
+ if grantUri == GroupAllUsers || grantUri == GroupAuthenticatedUsers {
+ return fmt.Sprintf("%s%s", "http://acs.amazonaws.com/groups/global/", grantUri)
}
- if grant.Grantee.URI == GroupLogDelivery {
- return fmt.Sprintf("%s%s", "http://acs.amazonaws.com/groups/s3/", grant.Grantee.URI)
+ if grantUri == GroupLogDelivery {
+ return fmt.Sprintf("%s%s", "http://acs.amazonaws.com/groups/s3/", grantUri)
}
- return fmt.Sprintf("%s", grant.Grantee.URI)
+ return fmt.Sprintf("%s", grantUri)
}
func convertGrantToXML(grant Grant, isObs bool, isBucket bool) string {
xml := make([]string, 0, 4)
+ if grant.Grantee.ID != "" &&
+ grant.Grantee.URI == "" &&
+ grant.Grantee.Type == "" {
+ grant.Grantee.Type = GranteeUser
+ }
+
+ if grant.Grantee.URI != "" &&
+ grant.Grantee.ID == "" &&
+ grant.Grantee.Type == "" {
+ grant.Grantee.Type = GranteeGroup
+ }
+
if grant.Grantee.Type == GranteeUser {
if isObs {
xml = append(xml, "")
@@ -126,7 +138,7 @@ func convertGrantToXML(grant Grant, isObs bool, isBucket bool) string {
} else {
if !isObs {
xml = append(xml, fmt.Sprintf("", grant.Grantee.Type))
- xml = append(xml, prepareGrantURI(grant))
+ xml = append(xml, prepareGrantURI(grant.Grantee.URI))
xml = append(xml, "")
} else if grant.Grantee.URI == GroupAllUsers {
xml = append(xml, "")
@@ -157,7 +169,11 @@ func ConvertLoggingStatusToXml(input BucketLoggingStatus, returnMd5 bool, isObs
grantsLength := len(input.TargetGrants)
xml := make([]string, 0, 8+grantsLength)
- xml = append(xml, "")
+ if isObs {
+ xml = append(xml, "")
+ } else {
+ xml = append(xml, ``)
+ }
if isObs && input.Agency != "" {
agency := XmlTranscoding(input.Agency)
xml = append(xml, fmt.Sprintf("%s", agency))
diff --git a/obs/extension.go b/obs/extension.go
index 8043247..9d96463 100644
--- a/obs/extension.go
+++ b/obs/extension.go
@@ -56,6 +56,7 @@ func WithCustomHeader(key string, value string) extensionHeaders {
if strings.TrimSpace(value) == "" {
return fmt.Errorf("set header %s with empty value", key)
}
+ allowedRequestHTTPHeaderMetadataNames[strings.ToLower(key)] = true
headers[key] = []string{value}
return nil
}
diff --git a/obs/http.go b/obs/http.go
index e3e3459..1bdb964 100644
--- a/obs/http.go
+++ b/obs/http.go
@@ -152,7 +152,7 @@ func (obsClient ObsClient) doAction(action, method, bucketName, objectKey string
for _, extension := range extensions {
if extensionHeader, ok := extension.(extensionHeaders); ok {
- if _err := extensionHeader(headers, isObs); err != nil {
+ if _err := extensionHeader(headers, isObs); _err != nil {
doLog(LEVEL_INFO, fmt.Sprintf("set header with error: %v", _err))
}
} else {
diff --git a/obs/log.go b/obs/log.go
index 9788d9a..bb46a90 100644
--- a/obs/log.go
+++ b/obs/log.go
@@ -364,10 +364,10 @@ func logResponseHeader(respHeader http.Header) string {
if key == "" {
continue
}
- if strings.HasPrefix(key, HEADER_PREFIX) || strings.HasPrefix(key, HEADER_PREFIX_OBS) {
- key = key[len(HEADER_PREFIX):]
- }
_key := strings.ToLower(key)
+ if strings.HasPrefix(_key, HEADER_PREFIX) || strings.HasPrefix(_key, HEADER_PREFIX_OBS) {
+ _key = _key[len(HEADER_PREFIX):]
+ }
if _, ok := allowedLogResponseHTTPHeaderNames[_key]; ok {
resp = append(resp, fmt.Sprintf("%s: [%s]", key, value[0]))
}
diff --git a/obs/model_other.go b/obs/model_other.go
index 4d4a320..78f426e 100644
--- a/obs/model_other.go
+++ b/obs/model_other.go
@@ -34,12 +34,20 @@ type CreateSignedUrlOutput struct {
ActualSignedRequestHeaders http.Header
}
+// ConditionRange the specifying ranges in the conditions
+type ConditionRange struct {
+ RangeName string
+ Lower int64
+ Upper int64
+}
+
// CreateBrowserBasedSignatureInput is the input parameter of CreateBrowserBasedSignature function.
type CreateBrowserBasedSignatureInput struct {
- Bucket string
- Key string
- Expires int
- FormParams map[string]string
+ Bucket string
+ Key string
+ Expires int
+ FormParams map[string]string
+ RangeParams []ConditionRange
}
// CreateBrowserBasedSignatureOutput is the result of CreateBrowserBasedSignature function.
diff --git a/obs/progress.go b/obs/progress.go
index 719b4f5..3eced48 100644
--- a/obs/progress.go
+++ b/obs/progress.go
@@ -1,3 +1,15 @@
+// Copyright 2019 Huawei Technologies Co.,Ltd.
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+// this file except in compliance with the License. You may obtain a copy of the
+// License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+
package obs
import (
diff --git a/obs/temporary_other.go b/obs/temporary_other.go
index d2ae13f..9c86f13 100644
--- a/obs/temporary_other.go
+++ b/obs/temporary_other.go
@@ -93,6 +93,10 @@ func (obsClient ObsClient) CreateBrowserBasedSignature(input *CreateBrowserBased
originPolicySlice = append(originPolicySlice, "[\"starts-with\", \"$key\", \"\"],")
}
+ for _, v := range input.RangeParams {
+ originPolicySlice = append(originPolicySlice, fmt.Sprintf("[\"%s\", %d, %d],", v.RangeName, v.Lower, v.Upper))
+ }
+
originPolicySlice = append(originPolicySlice, "]}")
originPolicy := strings.Join(originPolicySlice, "")