mirror of https://gitee.com/answerdev/answer.git
feat(visit): can visit branding image without token
This commit is contained in:
parent
c2b4a49dc0
commit
a0d57a1890
|
@ -4,11 +4,18 @@ import (
|
|||
"github.com/answerdev/answer/internal/base/constant"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// VisitAuth when user visit the site image, check visit token. This only for private mode.
|
||||
func (am *AuthUserMiddleware) VisitAuth() gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
// If visit brand image, no need to check visit token. Because the brand image is public.
|
||||
if strings.HasPrefix(ctx.Request.URL.Path, "/uploads/branding/") {
|
||||
ctx.Next()
|
||||
return
|
||||
}
|
||||
|
||||
siteLogin, err := am.siteInfoCommonService.GetSiteLogin(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue