feat: add hash_info
field to /fs/get
(close #5259)
This commit is contained in:
parent
2a6ab77295
commit
882112ed1c
@ -218,3 +218,7 @@ func FromString(str string) HashInfo {
|
|||||||
func (hi HashInfo) GetHash(ht *HashType) string {
|
func (hi HashInfo) GetHash(ht *HashType) string {
|
||||||
return hi.h[ht]
|
return hi.h[ht]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (hi HashInfo) Export() map[*HashType]string {
|
||||||
|
return hi.h
|
||||||
|
}
|
||||||
|
@ -41,7 +41,8 @@ type ObjResp struct {
|
|||||||
Sign string `json:"sign"`
|
Sign string `json:"sign"`
|
||||||
Thumb string `json:"thumb"`
|
Thumb string `json:"thumb"`
|
||||||
Type int `json:"type"`
|
Type int `json:"type"`
|
||||||
HashInfo string `json:"hashinfo"`
|
HashInfoStr string `json:"hashinfo"`
|
||||||
|
HashInfo map[*utils.HashType]string `json:"hash_info"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FsListResp struct {
|
type FsListResp struct {
|
||||||
@ -205,7 +206,8 @@ func toObjsResp(objs []model.Obj, parent string, encrypt bool) []ObjResp {
|
|||||||
IsDir: obj.IsDir(),
|
IsDir: obj.IsDir(),
|
||||||
Modified: obj.ModTime(),
|
Modified: obj.ModTime(),
|
||||||
Created: obj.CreateTime(),
|
Created: obj.CreateTime(),
|
||||||
HashInfo: obj.GetHash().String(),
|
HashInfoStr: obj.GetHash().String(),
|
||||||
|
HashInfo: obj.GetHash().Export(),
|
||||||
Sign: common.Sign(obj, parent, encrypt),
|
Sign: common.Sign(obj, parent, encrypt),
|
||||||
Thumb: thumb,
|
Thumb: thumb,
|
||||||
Type: utils.GetObjType(obj.GetName(), obj.IsDir()),
|
Type: utils.GetObjType(obj.GetName(), obj.IsDir()),
|
||||||
@ -318,7 +320,8 @@ func FsGet(c *gin.Context) {
|
|||||||
IsDir: obj.IsDir(),
|
IsDir: obj.IsDir(),
|
||||||
Modified: obj.ModTime(),
|
Modified: obj.ModTime(),
|
||||||
Created: obj.CreateTime(),
|
Created: obj.CreateTime(),
|
||||||
HashInfo: obj.GetHash().String(),
|
HashInfoStr: obj.GetHash().String(),
|
||||||
|
HashInfo: obj.GetHash().Export(),
|
||||||
Sign: common.Sign(obj, parentPath, isEncrypt(meta, reqPath)),
|
Sign: common.Sign(obj, parentPath, isEncrypt(meta, reqPath)),
|
||||||
Type: utils.GetFileType(obj.GetName()),
|
Type: utils.GetFileType(obj.GetName()),
|
||||||
Thumb: thumb,
|
Thumb: thumb,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user