diff options
author | Linus Nordberg <linus@nordberg.se> | 2014-10-09 18:31:59 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2014-10-09 18:31:59 +0200 |
commit | 7bd137827bb60481569f26bed3028398a5e5aa06 (patch) | |
tree | 6eff3b04a7084101665da9776f1b26a09667d074 /src | |
parent | 6ddb0363c5c9bb147f9a4fe0ba683bdba20b5389 (diff) |
Limit get-entries to 1000 entries at the time.
Diffstat (limited to 'src')
-rw-r--r-- | src/v1.erl | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -97,15 +97,14 @@ deliver(SessionID, R). 'get-entries'(SessionID, _Env, Input) -> - %% TODO: Limit the number of returned entries (i.e. start-end) to - %% something reasonable. R = case lists:sort(httpd:parse_query(Input)) of [{"end", EndInput}, {"start", StartInput}] -> {Start, _} = string:to_integer(StartInput), {End, _} = string:to_integer(EndInput), case lists:member(error, [Start, End]) of true -> html("get-entries: bad input:", [Start, End]); - false -> catlfish:entries(Start, End) + false -> catlfish:entries(Start, + min(max(End, Start), Start + 999)) end; _ -> html("get-entries: bad input:", Input) end, |