Skip to content

Commit

Permalink
Merge pull request #48 from Tsovak/tsovak/fix-panic
Browse files Browse the repository at this point in the history
Fix panic during error returning if Dataset\Query couldn't have found
  • Loading branch information
delfrrr authored Nov 29, 2022
2 parents ce4bb21 + eb7363e commit 4c80555
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/server/dekart/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package dekart
import (
"context"
"crypto/sha1"
"fmt"
"time"

"dekart/src/proto"
"dekart/src/server/job"
"dekart/src/server/user"
"fmt"
"time"

"github.com/google/uuid"
"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -284,6 +285,7 @@ func (s Server) CancelQuery(ctx context.Context, req *proto.CancelQueryRequest)
}
}
if reportID == "" {
err := fmt.Errorf("query not found id:%s", req.QueryId)
log.Warn().Str("QueryId", req.QueryId).Msg("Query not found")
return nil, status.Error(codes.NotFound, err.Error())
}
Expand Down
9 changes: 7 additions & 2 deletions src/server/user/claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ func (c ClaimsCheck) GetContext(r *http.Request) context.Context {
return userCtx
}

//GetClaims from the context
// GetClaims from the context
func GetClaims(ctx context.Context) *Claims {
return ctx.Value(contextKey).(*Claims)
value, isExist := ctx.Value(contextKey).(*Claims)
if isExist {
return value
}

return nil
}

func (c ClaimsCheck) getPublicKeyFromAmazon(token *jwt.Token) (interface{}, error) {
Expand Down

0 comments on commit 4c80555

Please sign in to comment.