fix(review): fix issues based on review comments

This commit is contained in:
Jörg Krzeslak
2026-10-22 19:08:32 +02:00
parent f7976fa55d
commit eb5e484042
4 changed files with 20 additions and 6 deletions
+5 -4
View File
@@ -85,6 +85,11 @@ const properties: Record<
properties: propertiesxelatex,
converter: convertxelatex,
},
// djvu before calibre so the dedicated ddjvu converter wins for DjVu files
djvu: {
properties: propertiesDjvu,
converter: convertDjvu,
},
calibre: {
properties: propertiesCalibre,
converter: convertCalibre,
@@ -93,10 +98,6 @@ const properties: Record<
properties: propertiesDasel,
converter: convertDasel,
},
djvu: {
properties: propertiesDjvu,
converter: convertDjvu,
},
libreoffice: {
properties: propertiesLibreOffice,
converter: convertLibreOffice,
+4
View File
@@ -67,6 +67,10 @@ export const convert = new Elysia().use(userService).post(
return redirect(`${WEBROOT}/`, 302);
}
if (!fileNames.every((name) => typeof name === "string")) {
return redirect(`${WEBROOT}/`, 302);
}
for (let i = 0; i < fileNames.length; i++) {
fileNames[i] = sanitize(fileNames[i] || "");
}
+2 -1
View File
@@ -9,7 +9,7 @@ import path from "node:path";
export const deleteFile = new Elysia().use(userService).post(
"/delete",
async ({ body, redirect, cookie: { jobId }, user }) => {
async ({ body, redirect, set, cookie: { jobId }, user }) => {
if (!jobId?.value) {
return redirect(`${WEBROOT}/`, 302);
}
@@ -31,6 +31,7 @@ export const deleteFile = new Elysia().use(userService).post(
await unlink(targetPath);
} catch (e) {
if ((e as NodeJS.ErrnoException).code === "ENOENT") {
set.status = 404;
return { message: "File not found." };
}
throw e;
+9 -1
View File
@@ -38,7 +38,15 @@ export const root = new Elysia().use(userService).get(
try {
const verifiedUser = await jwt.verify(auth.value);
if (verifiedUser && verifiedUser.id) {
user = verifiedUser;
const numericId = Number.parseInt(verifiedUser.id);
// IDs below the anonymous range (excluding shared 0) are registered users
const isRegistered = numericId > 0 && numericId < 2 ** 24;
if (
!isRegistered ||
db.query("SELECT * FROM users WHERE id = ?").as(User).get(verifiedUser.id)
) {
user = verifiedUser;
}
}
} catch {
// Invalid cookie, fall through to anonymous creation