Test: thumbnail and authn / Modify: read thumbnail config from file

This commit is contained in:
HFO4
2019-12-09 11:33:39 +08:00
parent f35c585edf
commit c3c0e92964
13 changed files with 491 additions and 98 deletions

View File

@ -2,6 +2,7 @@ package local
import (
"context"
"github.com/HFO4/cloudreve/pkg/conf"
"github.com/HFO4/cloudreve/pkg/filesystem/response"
"github.com/HFO4/cloudreve/pkg/util"
"io"
@ -78,7 +79,7 @@ func (handler Handler) Delete(ctx context.Context, files []string) ([]string, er
}
// 尝试删除文件的缩略图(如果有)
_ = os.Remove(value + "._thumb")
_ = os.Remove(value + conf.ThumbConfig.FileSuffix)
}
return deleteFailed, retErr
@ -86,7 +87,7 @@ func (handler Handler) Delete(ctx context.Context, files []string) ([]string, er
// Thumb 获取文件缩略图
func (handler Handler) Thumb(ctx context.Context, path string) (*response.ContentResponse, error) {
file, err := handler.Get(ctx, path+"._thumb")
file, err := handler.Get(ctx, path+conf.ThumbConfig.FileSuffix)
if err != nil {
return nil, err
}