- Built by the SSTAA App Team and open sourced on
+ Built by the SSTAA App Team and open sourced on
GitHub
.
diff --git a/server/routes/cdn/[...path].ts b/server/routes/cdn/[...path].ts
index e707242..def6fc7 100644
--- a/server/routes/cdn/[...path].ts
+++ b/server/routes/cdn/[...path].ts
@@ -1,8 +1,13 @@
import type { R2Bucket } from '@cloudflare/workers-types'
export default defineEventHandler(async (event) => {
- if (!event.context.cloudflare)
- return 'Cloudflare R2 is not available in this environment.'
+ if (!event.context.cloudflare) {
+ throw createError({
+ statusCode: 404,
+ statusMessage: 'Not found',
+ message: 'Cloudflare R2 is not available in this environment.',
+ })
+ }
const bucket: R2Bucket = event.context.cloudflare.env.R2_SSTAA
const file = await bucket.get(event.context.params!.path)