Skip to content

Conversation

@hannessolo
Copy link
Contributor

Fix #150

@codecov
Copy link

codecov bot commented Jul 21, 2025

Codecov Report

Attention: Patch coverage is 98.26590% with 3 lines in your changes missing coverage. Please review.

Project coverage is 87.26%. Comparing base (28fb718) to head (9284e61).

Files with missing lines Patch % Lines
src/storage/object/list.js 96.72% 2 Missing ⚠️
src/index.js 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hannessolo hannessolo marked this pull request as draft July 21, 2025 13:35
Comment on lines 24 to 31
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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .

@hannessolo hannessolo marked this pull request as ready for review July 22, 2025 10:01
@bosschaert
Copy link
Contributor

Looks good to me. I like that there are a lot of new tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[List] Offset & Limit

4 participants