Skip to content

Commit

Permalink
Merge branch 'master' into Fix-Pili-Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
LixvYang authored Oct 17, 2023
2 parents 3179d66 + 441f02e commit 08c12f8
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 10 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ jobs:
# new package name don't work in non-module mode
rm -rf $GITHUB_WORKSPACE/src/github.com/go-playground/validator/v10 && git clone -b v10.9.0 --depth 1 https://github.com/go-playground/validator.git $GITHUB_WORKSPACE/src/github.com/go-playground/validator/v10
rm -rf $GITHUB_WORKSPACE/src/github.com/universal-translator && git clone -b v0.18.0 --depth 1 https://github.com/go-playground/universal-translator.git $GITHUB_WORKSPACE/src/github.com/go-playground/universal-translator
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/crypto && git clone -b v0.10.0 --depth 1 https://go.googlesource.com/crypto $GITHUB_WORKSPACE/src/golang.org/x/crypto
# GOPATH=$GITHUB_WORKSPACE go get golang.org/x/crypto/sha3
rm -rf $GITHUB_WORKSPACE/src/golang.org/x/text && git clone -b v0.10.0 --depth 1 https://github.com/golang/text $GITHUB_WORKSPACE/src/golang.org/x/text
# GOPATH=$GITHUB_WORKSPACE go get golang.org/x/text/language
GOPATH=$GITHUB_WORKSPACE go get github.com/leodido/go-urn
GOPATH=$GITHUB_WORKSPACE go get golang.org/x/crypto/sha3
GOPATH=$GITHUB_WORKSPACE go get golang.org/x/text/language
GOPATH=$GITHUB_WORKSPACE go get github.com/go-playground/locales
# github.com/stretchr/testify
Expand All @@ -45,7 +50,7 @@ jobs:
GOPATH=$GITHUB_WORKSPACE go get github.com/davecgh/go-spew/spew
GOPATH=$GITHUB_WORKSPACE go get github.com/pmezard/go-difflib/difflib
GOPATH=$GITHUB_WORKSPACE go get gopkg.in/yaml.v3
GOPATH=$GITHUB_WORKSPACE make unittest
working-directory: src/github.com/qiniu/go-sdk
go-mod-test:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Changelog
## 7.18.1
* 调整
* PutPolicy 的 DetectMime 支持配置为 -1

## 7.18.0
* 新增
* BucketManager 支持下载
* BucketManager 支持获取和修改对象 meta data
* 上传和下载支持单链限速
* 优化
* 区域缓存信息 ID 和查询域名相关

## 7.17.1
* 优化
* 调整在获取 Bucket 所在区域服务域名时的主备域名顺序
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ github.com/qiniu/go-sdk
在您的项目中的 `go.mod` 文件内添加这行代码

```
require github.com/qiniu/go-sdk/v7 v7.17.1
require github.com/qiniu/go-sdk/v7 v7.18.1
```

并且在项目中使用 `"github.com/qiniu/go-sdk/v7"` 引用 Qiniu Go SDK。
Expand Down
2 changes: 1 addition & 1 deletion conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
)

const Version = "7.17.1"
const Version = "7.18.1"

const (
CONTENT_TYPE_JSON = "application/json"
Expand Down
3 changes: 3 additions & 0 deletions internal/clientv2/interceptor_retry_hosts.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package clientv2

import (
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -111,6 +113,7 @@ func (interceptor *hostsRetryInterceptor) Intercept(req *http.Request, handler H
req = reqBefore

if resp != nil && resp.Body != nil {
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
}

Expand Down
2 changes: 2 additions & 0 deletions internal/clientv2/interceptor_retry_simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package clientv2

import (
"io"
"io/ioutil"
"math/rand"
"net"
"net/http"
Expand Down Expand Up @@ -84,6 +85,7 @@ func (interceptor *simpleRetryInterceptor) Intercept(req *http.Request, handler
}

if resp != nil && resp.Body != nil {
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
}

Expand Down
15 changes: 10 additions & 5 deletions storage/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@ type PutPolicy struct {
FsizeLimit int64 `json:"fsizeLimit,omitempty"`

// 开启 MimeType 侦测功能,并按照下述规则进行侦测;如不能侦测出正确的值,会默认使用 application/octet-stream 。
// 设为非 0 值,则忽略上传端传递的文件 MimeType 信息,并按如下顺序侦测 MimeType 值:
// 1. 侦测内容; 2. 检查文件扩展名; 3. 检查 Key 扩展名。
// 默认设为 0 值,如上传端指定了 MimeType 则直接使用该值,否则按如下顺序侦测 MimeType 值:
// 1. 检查文件扩展名; 2. 检查 Key 扩展名; 3. 侦测内容。
DetectMime uint8 `json:"detectMime,omitempty"`
// 默认设为 0 时:如上传端指定了 MimeType 则直接使用该值,否则按如下顺序侦测 MimeType 值:
// 1. 检查文件扩展名;
// 2. 检查 Key 扩展名;
// 3. 侦测内容。
// 设为 1 时:则忽略上传端传递的文件 MimeType 信息,并按如下顺序侦测 MimeType 值:
// 1. 侦测内容;
// 2. 检查文件扩展名;
// 3. 检查 Key 扩展名。
// 设为 -1 时:无论上传端指定了何值直接使用该值。
DetectMime int `json:"detectMime,omitempty"`

// 限定用户上传的文件类型。指定本字段值,七牛服务器会侦测文件内容以判断 MimeType,再用判断值跟指定值进行匹配,匹配成功则允许上传,匹配失败则返回 403 状态码。示例:
// image/* 表示只允许上传图片类型
Expand Down

0 comments on commit 08c12f8

Please sign in to comment.