Comparison

mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 3572:7700c9537e90

mod_storage_xmlarchive: Return error if range request reference missing items (see #1325)
author Kim Alvefur <zash@zash.se>
date Fri, 03 May 2019 21:07:51 +0200
parent 3571:f5ea0b886c7c
child 3585:ddf109d58eff
comparison
equal deleted inserted replaced
3571:f5ea0b886c7c 3572:7700c9537e90
127 local first_item, last_item; 127 local first_item, last_item;
128 if rev then 128 if rev then
129 start_day, step, last_day = last_day, -step, start_day; 129 start_day, step, last_day = last_day, -step, start_day;
130 if query.before then 130 if query.before then
131 local before_day, before_item, items_ = self:_get_idx(username, query.before, dates); 131 local before_day, before_item, items_ = self:_get_idx(username, query.before, dates);
132 if before_day and before_day <= start_day then 132 if not before_day then
133 return nil, "item-not-found";
134 elseif before_day <= start_day then
133 if before_item then 135 if before_item then
134 first_item = before_item - 1; 136 first_item = before_item - 1;
135 else 137 else
136 first_item = #items_; 138 first_item = #items_;
137 end 139 end
140 items = items_; 142 items = items_;
141 end 143 end
142 end 144 end
143 elseif query.after then 145 elseif query.after then
144 local after_day, after_item, items_ = self:_get_idx(username, query.after, dates); 146 local after_day, after_item, items_ = self:_get_idx(username, query.after, dates);
145 if after_day and after_day >= start_day then 147 if not after_day then
148 return nil, "item-not-found";
149 elseif after_day >= start_day then
146 if after_item then 150 if after_item then
147 first_item = after_item + 1; 151 first_item = after_item + 1;
148 else 152 else
149 first_item = 1; 153 first_item = 1;
150 end 154 end