@@ -39,18 +39,19 @@ func (this *StaticController) Uploads() {
3939 file := strings .TrimLeft (this .GetString (":splat" ), "./" )
4040 path := strings .ReplaceAll (filepath .Join ("uploads" , file ), "\\ " , "/" )
4141
42- // 签名验证
43- sign := this .GetString ("sign" )
44- if ! this .isValidSign (sign , path ) {
45- // 签名验证不通过,需要再次验证书籍是否是用户的(针对编辑状态)
46- if ! this .isBookOwner () {
47- this .Abort ("404" )
48- return
42+ if this .isMedia (path ) { // 签名验证
43+ sign := this .GetString ("sign" )
44+ if ! this .isValidSign (sign , path ) {
45+ // 签名验证不通过,需要再次验证书籍是否是用户的(针对编辑状态)
46+ if ! this .isBookOwner () {
47+ this .Abort ("404" )
48+ return
49+ }
4950 }
50- }
5151
52- if utils .IsSignUsed (sign ) {
53- this .Abort ("404" )
52+ if utils .IsSignUsed (sign ) {
53+ this .Abort ("404" )
54+ }
5455 }
5556
5657 http .ServeFile (this .Ctx .ResponseWriter , this .Ctx .Request , path )
@@ -63,7 +64,8 @@ func (this *StaticController) StaticFile() {
6364 http .ServeFile (this .Ctx .ResponseWriter , this .Ctx .Request , file )
6465 return
6566 }
66- file = strings .TrimLeft (file , "./" )
67+ fmt .Println (file , "===============" )
68+ file = strings .ReplaceAll (strings .TrimLeft (file , "./" ), "\\ " , "/" )
6769 path := filepath .Join (utils .VirtualRoot , file )
6870 http .ServeFile (this .Ctx .ResponseWriter , this .Ctx .Request , path )
6971}
0 commit comments