Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #155 +/- ##
==========================================
+ Coverage 86.71% 87.26% +0.55%
==========================================
Files 39 40 +1
Lines 2243 2364 +121
==========================================
+ Hits 1945 2063 +118
- Misses 298 301 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/routes/list-paginated.js
Outdated
| const limit = Number.parseInt(searchParams.get('limit'), 10) ?? null; | ||
| const offset = Number.parseInt(searchParams.get('offset'), 10) ?? null; | ||
|
|
||
| function numOrUndef(num) { | ||
| return Number.isNaN(num) ? undefined : num; | ||
| } | ||
|
|
||
| return /* await */ listObjectsPaginated(env, daCtx, numOrUndef(limit), numOrUndef(offset)); |
There was a problem hiding this comment.
The ?? null will never trigger with NaN. Assuming that 0 is an invalid param for limit and offset you could use:
const limit = Number.parseInt(searchParams.get('limit'), 10) || undefined;
There was a problem hiding this comment.
Thanks. Unfortunately 0 for offset is a valid input - I'll just remove the ?? null, it's a leftover from before I realised that it parseInt returns NaN and not null.
| import { getChildRules, hasPermission } from '../utils/auth.js'; | ||
|
|
||
| export default async function getListPaginated({ req, env, daCtx }) { | ||
| if (!daCtx.org) return listBuckets(env, daCtx); |
There was a problem hiding this comment.
Should we even support listing buckets on this new API endpoint? With the infrastructure move, this shouldn't be needed anymore, as we have all sites in one bucket @auniverseaway .
|
Looks good to me. I like that there are a lot of new tests. |
Fix #150