Skip to content

Commit

Permalink
fix: BUCKET.list filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray-D-Song committed Oct 30, 2024
1 parent 0d4057d commit 13f66c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions packages/server/src/api/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ app.get('/page_chart_data', async (c) => {
})

app.get('/r2_usage', async (c) => {
const res = await c.env.BUCKET.list({
prefix: 'web-archive',
})
const res = await c.env.BUCKET.list()
return c.json(result.success({
size: res.objects.reduce((acc, obj) => acc + obj.size, 0),
count: res.objects.length,
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/components/r2-usage-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function R2UsageCard() {
objects
</section>
<section>
<span>{Math.round((data?.size ?? 0) / 1024 / 1024 / 1024)}</span>
<span>{Math.round((data?.size ?? 0) / 1024 / 1024)}</span>
{' '}
GB
MB
</section>
</div>
</CardContent>
Expand Down

0 comments on commit 13f66c0

Please sign in to comment.