Skip to content

Commit

Permalink
fix panic when expiry is unset
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Jun 7, 2023
1 parent 37f14fb commit fa09a8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ func FilterFiltersByType(f []*collaboration.Filter, t collaboration.Filter_Type)

// IsExpired tests whether a share is expired
func IsExpired(s *collaboration.Share) bool {
expiration := time.Unix(int64(s.Expiration.GetSeconds()), int64(s.Expiration.GetNanos()))
return s.Expiration != nil && expiration.Before(time.Now())
if e := s.GetExpiration(); e != nil {
expiration := time.Unix(int64(e.Seconds), int64(e.Nanos))
return expiration.Before(time.Now())
}
return false
}

0 comments on commit fa09a8e

Please sign in to comment.