@@ -195,6 +195,7 @@ func SharingArchiveList(c *gin.Context, req *ArchiveListReq) {
195195func SharingDown (c * gin.Context ) {
196196 sid := c .Request .Context ().Value (conf .SharingIDKey ).(string )
197197 path := c .Request .Context ().Value (conf .PathKey ).(string )
198+ path = utils .FixAndCleanPath (path )
198199 pwd := c .Query ("pwd" )
199200 s , err := op .GetSharingById (sid )
200201 if err == nil {
@@ -219,6 +220,13 @@ func SharingDown(c *gin.Context) {
219220 return
220221 }
221222 if setting .GetBool (conf .ShareForceProxy ) || common .ShouldProxy (storage , stdpath .Base (actualPath )) {
223+ if _ , ok := c .GetQuery ("d" ); ! ok {
224+ if url := common .GenerateDownProxyURL (storage .GetStorage (), unwrapPath ); url != "" {
225+ c .Redirect (302 , url )
226+ _ = countAccess (c .ClientIP (), s )
227+ return
228+ }
229+ }
222230 link , obj , err := op .Link (c .Request .Context (), storage , actualPath , model.LinkArgs {
223231 Header : c .Request .Header ,
224232 Type : c .Query ("type" ),
@@ -252,6 +260,7 @@ func SharingArchiveExtract(c *gin.Context) {
252260 }
253261 sid := c .Request .Context ().Value (conf .SharingIDKey ).(string )
254262 path := c .Request .Context ().Value (conf .PathKey ).(string )
263+ path = utils .FixAndCleanPath (path )
255264 pwd := c .Query ("pwd" )
256265 innerPath := utils .FixAndCleanPath (c .Query ("inner" ))
257266 archivePass := c .Query ("pass" )
0 commit comments