Refactor: factory method for OSS client

Fix: use HTTPS schema by default in OSS client
Feat: new handler for Qiniu policy
This commit is contained in:
HFO4
2022-03-20 11:26:26 +08:00
parent 0df9529b32
commit 07f13cc350
13 changed files with 221 additions and 206 deletions

View File

@@ -152,7 +152,7 @@ func (policy *Policy) GeneratePath(uid uint, origin string) string {
func (policy *Policy) GenerateFileName(uid uint, origin string) string {
// 未开启自动重命名时,直接返回原始文件名
if !policy.AutoRename {
return policy.getOriginNameRule(origin)
return origin
}
fileRule := policy.FileNameRule
@@ -171,10 +171,9 @@ func (policy *Policy) GenerateFileName(uid uint, origin string) string {
"{hour}": time.Now().Format("15"),
"{minute}": time.Now().Format("04"),
"{second}": time.Now().Format("05"),
"{originname}": origin,
}
replaceTable["{originname}"] = policy.getOriginNameRule(origin)
fileRule = util.Replace(replaceTable, fileRule)
return fileRule
}
@@ -232,7 +231,7 @@ func (policy *Policy) IsUploadPlaceholderWithSize() bool {
return true
}
if policy.Type == "onedrive" || policy.Type == "oss" {
if util.ContainsString([]string{"onedrive", "oss", "qiniu"}, policy.Type) {
return policy.OptionsSerialized.PlaceholderWithSize
}