store: burn_after_reads>0 implies burn-after-read mode (#82)
This commit is contained in:
@@ -211,13 +211,17 @@ func (s *Store) CreatePaste(p *Paste) (*Paste, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// #49: burn-after-read pastes carry a read budget (default 1 read)
|
||||
if p.BurnAfterRead {
|
||||
// #49/#82: burn-after-read pastes carry a read budget (default 1 read).
|
||||
// burn_after_reads > 0 alone implies burn mode even without burn_after_read.
|
||||
if p.BurnAfterRead || (p.BurnAfterReads != nil && *p.BurnAfterReads > 0) {
|
||||
limit := int64(1)
|
||||
if p.BurnAfterReads != nil && *p.BurnAfterReads > 0 {
|
||||
limit = int64(*p.BurnAfterReads)
|
||||
}
|
||||
p.readsLimit = &limit
|
||||
if !p.BurnAfterRead {
|
||||
p.BurnAfterRead = true
|
||||
}
|
||||
}
|
||||
|
||||
visibility := p.Visibility
|
||||
|
||||
Reference in New Issue
Block a user