Skip to content

Commit

Permalink
Fix skip cache error
Browse files Browse the repository at this point in the history
  • Loading branch information
杨赫然 committed Dec 24, 2024
1 parent db8c637 commit bcaf972
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fileserver/sync_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1283,13 +1283,15 @@ func validateToken(r *http.Request, repoID string, skipCache bool) (string, *app
}
}

if value, ok := tokenCache.Load(token); ok {
if info, ok := value.(*tokenInfo); ok {
if info.repoID != repoID {
msg := "Invalid token"
return "", &appError{nil, msg, http.StatusForbidden}
if !skipCache {
if value, ok := tokenCache.Load(token); ok {
if info, ok := value.(*tokenInfo); ok {
if info.repoID != repoID {
msg := "Invalid token"
return "", &appError{nil, msg, http.StatusForbidden}
}
return info.email, nil
}
return info.email, nil
}
}

Expand Down

0 comments on commit bcaf972

Please sign in to comment.