fix: access token checks

This commit is contained in:
Steven 2023-08-16 18:55:11 +08:00
parent d97a7e736d
commit 946548b33a

View File

@ -71,7 +71,7 @@ func JWTMiddleware(s *APIV1Service, next echo.HandlerFunc, secret string) echo.H
token := findAccessToken(c) token := findAccessToken(c)
if token == "" { if token == "" {
// When the request is not authenticated, we allow the user to access the shortcut endpoints for those public shortcuts. // When the request is not authenticated, we allow the user to access the shortcut endpoints for those public shortcuts.
if util.HasPrefixes(path, "/s/*") && method == http.MethodGet { if util.HasPrefixes(path, "/s/") && method == http.MethodGet {
return next(c) return next(c)
} }
return echo.NewHTTPError(http.StatusUnauthorized, "Missing access token") return echo.NewHTTPError(http.StatusUnauthorized, "Missing access token")