Skip to content

Commit

Permalink
PutPolicy support set -1 & version to 7.18.1 (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSen-qn committed Oct 17, 2023
1 parent f62a9c1 commit 441f02e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## 7.18.1
* 调整
* PutPolicy 的 DetectMime 支持配置为 -1

## 7.18.0
* 新增
* BucketManager 支持下载
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.18.0
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.18.0"
const Version = "7.18.1"

const (
CONTENT_TYPE_JSON = "application/json"
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 441f02e

Please sign in to comment.