mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Test: Share model
This commit is contained in:
@@ -240,7 +240,7 @@ func (fs *FileSystem) GetDownloadURL(ctx context.Context, path string, timeout s
|
||||
return source, nil
|
||||
}
|
||||
|
||||
// GetSource 获取可直接访问文件的外链地址
|
||||
// Source 获取可直接访问文件的外链地址
|
||||
func (fs *FileSystem) GetSource(ctx context.Context, fileID uint) (string, error) {
|
||||
// 查找文件记录
|
||||
err := fs.resetFileIDIfNotExist(ctx, fileID)
|
||||
|
||||
@@ -34,7 +34,7 @@ type shareSource struct {
|
||||
|
||||
// BuildShareResponse 构建获取分享信息响应
|
||||
func BuildShareResponse(share *model.Share, unlocked bool) Share {
|
||||
creator := share.GetCreator()
|
||||
creator := share.Creator()
|
||||
resp := Share{
|
||||
Key: hashid.HashID(share.ID, hashid.ShareID),
|
||||
Locked: !unlocked,
|
||||
@@ -62,13 +62,13 @@ func BuildShareResponse(share *model.Share, unlocked bool) Share {
|
||||
}
|
||||
|
||||
if share.IsDir {
|
||||
source := share.GetSourceFolder()
|
||||
source := share.SourceFolder()
|
||||
resp.Source = &shareSource{
|
||||
Name: source.Name,
|
||||
Size: 0,
|
||||
}
|
||||
} else {
|
||||
source := share.GetSourceFile()
|
||||
source := share.SourceFile()
|
||||
resp.Source = &shareSource{
|
||||
Name: source.Name,
|
||||
Size: source.Size,
|
||||
|
||||
Reference in New Issue
Block a user