Browse Source

fixed entry is expired issue (fix: #120)

dependabot/npm_and_yarn/web/prismjs-1.21.0
Max Schmitt 7 years ago
parent
commit
c5fa7314ef
  1. 5
      internal/stores/store.go

5
internal/stores/store.go

@ -74,10 +74,9 @@ func (s *Store) GetEntryByID(id string) (*shared.Entry, error) {
func (s *Store) GetEntryAndIncrease(id string) (*shared.Entry, error) { func (s *Store) GetEntryAndIncrease(id string) (*shared.Entry, error) {
entry, err := s.GetEntryByID(id) entry, err := s.GetEntryByID(id)
if err != nil { if err != nil {
errors.Wrap(err, "could not fetch entry "+id) return nil, errors.Wrap(err, "could not fetch entry "+id)
return nil, err
} }
if entry.Public.Expiration != nil && time.Now().After(*entry.Public.Expiration) { if entry.Public.Expiration != nil && !entry.Public.Expiration.IsZero() && time.Now().After(*entry.Public.Expiration) {
return nil, ErrEntryIsExpired return nil, ErrEntryIsExpired
} }
if err := s.storage.IncreaseVisitCounter(id); err != nil { if err := s.storage.IncreaseVisitCounter(id); err != nil {

Loading…
Cancel
Save