Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Commit c5fa731

Browse files
committed
fixed entry is expired issue (fix: #120)
1 parent f6e7e6f commit c5fa731

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

internal/stores/store.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ func (s *Store) GetEntryByID(id string) (*shared.Entry, error) {
7474
func (s *Store) GetEntryAndIncrease(id string) (*shared.Entry, error) {
7575
entry, err := s.GetEntryByID(id)
7676
if err != nil {
77-
errors.Wrap(err, "could not fetch entry "+id)
78-
return nil, err
77+
return nil, errors.Wrap(err, "could not fetch entry "+id)
7978
}
80-
if entry.Public.Expiration != nil && time.Now().After(*entry.Public.Expiration) {
79+
if entry.Public.Expiration != nil && !entry.Public.Expiration.IsZero() && time.Now().After(*entry.Public.Expiration) {
8180
return nil, ErrEntryIsExpired
8281
}
8382
if err := s.storage.IncreaseVisitCounter(id); err != nil {

0 commit comments

Comments
 (0)