Update index.ts
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@ class HttpError extends Error {
|
|||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function done(status: number, content: string | object) {
|
function done(status: number, content: string | object): never {
|
||||||
throw new HttpError(status, content)
|
throw new HttpError(status, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ export const app = new Elysia()
|
|||||||
const photo = metadata.find((p) => p.id === id)
|
const photo = metadata.find((p) => p.id === id)
|
||||||
|
|
||||||
// Not found or hidden
|
// Not found or hidden
|
||||||
if (!photo || photo.hide === true) throw done(404, "Photo not found")
|
if (!photo || photo.hide === true) done(404, "Photo not found")
|
||||||
|
|
||||||
const file = Bun.file(photo.edited_photo.path)
|
const file = Bun.file(photo.edited_photo.path)
|
||||||
if (!(await file.exists())) {
|
if (!(await file.exists())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user