@@ -86,7 +86,7 @@ func FsList(c *gin.Context) {
8686 provider = storage .GetStorage ().Driver
8787 }
8888 common .SuccessResp (c , FsListResp {
89- Content : toObjResp (objs , isEncrypt (meta , req .Path )),
89+ Content : toObjResp (objs , req . Path , isEncrypt (meta , req .Path )),
9090 Total : int64 (total ),
9191 Readme : getReadme (meta , req .Path ),
9292 Write : user .CanWrite () || canWrite (meta , req .Path ),
@@ -196,7 +196,7 @@ func pagination(objs []model.Obj, req *common.PageReq) (int, []model.Obj) {
196196 return total , objs [start :end ]
197197}
198198
199- func toObjResp (objs []model.Obj , encrypt bool ) []ObjResp {
199+ func toObjResp (objs []model.Obj , parent string , encrypt bool ) []ObjResp {
200200 var resp []ObjResp
201201 for _ , obj := range objs {
202202 thumb := ""
@@ -212,7 +212,7 @@ func toObjResp(objs []model.Obj, encrypt bool) []ObjResp {
212212 Size : obj .GetSize (),
213213 IsDir : obj .IsDir (),
214214 Modified : obj .ModTime (),
215- Sign : common .Sign (obj , encrypt ),
215+ Sign : common .Sign (obj , parent , encrypt ),
216216 Thumb : thumb ,
217217 Type : tp ,
218218 })
@@ -275,12 +275,12 @@ func FsGet(c *gin.Context) {
275275 rawURL = fmt .Sprintf ("%s%s?sign=%s" ,
276276 strings .Split (storage .GetStorage ().DownProxyUrl , "\n " )[0 ],
277277 utils .EncodePath (req .Path , true ),
278- sign .Sign (obj . GetName () ))
278+ sign .Sign (req . Path ))
279279 } else {
280280 rawURL = fmt .Sprintf ("%s/p%s?sign=%s" ,
281281 common .GetApiUrl (c .Request ),
282282 utils .EncodePath (req .Path , true ),
283- sign .Sign (obj . GetName () ))
283+ sign .Sign (req . Path ))
284284 }
285285 } else {
286286 // file have raw url
@@ -310,13 +310,13 @@ func FsGet(c *gin.Context) {
310310 Size : obj .GetSize (),
311311 IsDir : obj .IsDir (),
312312 Modified : obj .ModTime (),
313- Sign : common .Sign (obj , isEncrypt (meta , req .Path )),
313+ Sign : common .Sign (obj , parentPath , isEncrypt (meta , req .Path )),
314314 Type : utils .GetFileType (obj .GetName ()),
315315 },
316316 RawURL : rawURL ,
317317 Readme : getReadme (meta , req .Path ),
318318 Provider : provider ,
319- Related : toObjResp (related , isEncrypt (parentMeta , parentPath )),
319+ Related : toObjResp (related , parentPath , isEncrypt (parentMeta , parentPath )),
320320 })
321321}
322322
0 commit comments