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

@@ -102,6 +102,7 @@ solid #e9e9e9;"bgcolor="#fff"><tbody><tr style="font-family: 'Helvetica Neue',He
{Name: "oss_timeout", Value: `3600`, Type: "timeout"},
{Name: "archive_timeout", Value: `30`, Type: "timeout"},
{Name: "download_timeout", Value: `30`, Type: "timeout"},
{Name: "preview_timeout", Value: `60`, Type: "timeout"},
{Name: "doc_preview_timeout", Value: `60`, Type: "timeout"},
{Name: "upload_credential_timeout", Value: `1800`, Type: "timeout"},
{Name: "upload_session_timeout", Value: `86400`, Type: "timeout"},

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