Modify: Decide whether to redirect when previewing based on storage policy

This commit is contained in:
HFO4
2019-12-31 13:09:26 +08:00
parent eceee2fc76
commit 8a262a15d5
7 changed files with 144 additions and 34 deletions

View File

@@ -67,6 +67,12 @@ func GetPolicyByID(ID interface{}) (Policy, error) {
return policy, result.Error
}
// IsDirectlyPreview 返回此策略下文件是否可以直接预览(不需要重定向)
// TODO 测试
func (policy *Policy) IsDirectlyPreview() bool {
return policy.Type == "local"
}
// AfterFind 找到存储策略后的钩子
func (policy *Policy) AfterFind() (err error) {
// 解析存储策略设置到OptionsSerialized