Skip to content

Commit

Permalink
fix panic when expiry is unset (#3955)
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic authored Jun 8, 2023
1 parent 238a03c commit 2fe516b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog/unreleased/fix-panic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bugfix: fix panic

https://github.com/cs3org/reva/pull/3955

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 2fe516b

Please sign in to comment.