new filenames + backfill

This commit is contained in:
2026-06-02 16:35:34 +02:00
parent 2c88953d97
commit a0ef658684
4 changed files with 251 additions and 5 deletions

View File

@@ -19,7 +19,8 @@ const sendJson = (res, data, code = 200) => {
// Generate UUID using the same method as video uploads
const genuuid = async () => {
return (await db`select gen_random_uuid() as uuid`)[0].uuid.substring(0, 8);
const raw = (await db`select replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', '') as uuid`)[0].uuid;
return raw.substring(0, 48);
};
export const handleAvatarUpload = async (req, res) => {

View File

@@ -277,9 +277,10 @@ export default new class queue {
};
async genuuid() {
return (await db`
select gen_random_uuid() as uuid
`)[0].uuid.substring(0, 8);
const raw = (await db`
select replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', '') as uuid
`)[0].uuid;
return raw.substring(0, 48);
};
async checkrepostlink(link) {

View File

@@ -104,7 +104,8 @@ export const handleRethumbUpload = async (req, res, itemId) => {
}
// Save to tmp for verification
const uuid = (await db`select gen_random_uuid() as uuid`)[0].uuid.substring(0, 8);
const raw = (await db`select replace(gen_random_uuid()::text, '-', '') || replace(gen_random_uuid()::text, '-', '') as uuid`)[0].uuid;
const uuid = raw.substring(0, 48);
const tmpPath = path.join(cfg.paths.tmp, `rethumb_${uuid}_${itemId}`);
await fs.mkdir(cfg.paths.tmp, { recursive: true });