Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/1.2.0/img' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkinStars committed Oct 10, 2023
2 parents ff24189 + a0d57a1 commit e55f633
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/base/middleware/visit_img_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e55f633

Please sign in to comment.