Skip to content

Commit

Permalink
fix: disallowed user-defined pager TTL
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyPunk committed Feb 6, 2025
1 parent b739af3 commit 6afa521
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions api/middleware/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,9 @@ func Pager(defaultCreatePager bool, defaultPagerID string, defaultPagerTTL time.
createPager = defaultCreatePager
}

var pagerTTL time.Duration
pagerTTLRaw, err := strconv.ParseUint(urlValues.Get("pagerTTL"), 10, 64)
if err == nil {
pagerTTL = time.Duration(pagerTTLRaw)
} else {
pagerTTL = defaultPagerTTL
}

ctxPager := context.WithValue(request.Context(), pagerIDKey, pagerID)
ctxSize := context.WithValue(ctxPager, createPagerKey, createPager)
ctxTTL := context.WithValue(ctxSize, pagerTTLKey, pagerTTL)
ctxTTL := context.WithValue(ctxSize, pagerTTLKey, defaultPagerTTL)
next.ServeHTTP(writer, request.WithContext(ctxTTL))
})
}
Expand Down

0 comments on commit 6afa521

Please sign in to comment.