mirror of
https://github.com/diced/zipline.git
synced 2026-06-12 10:51:17 -07:00
fix: block thumbnails on files w/ passwords
This commit is contained in:
@@ -4,6 +4,7 @@ import { parseRange } from '@/lib/api/range';
|
||||
import { config } from '@/lib/config';
|
||||
import { datasource } from '@/lib/datasource';
|
||||
import { prisma } from '@/lib/db';
|
||||
import { sanitizeFilename } from '@/lib/fs';
|
||||
import { log } from '@/lib/logger';
|
||||
import { guess } from '@/lib/mimes';
|
||||
import { TimedCache } from '@/lib/timedCache';
|
||||
@@ -34,10 +35,16 @@ export const rawFileHandler = async (
|
||||
const { id } = req.params;
|
||||
const { token, download } = req.query;
|
||||
|
||||
const idSanitized = sanitizeFilename(id);
|
||||
if (!idSanitized) return res.callNotFound();
|
||||
|
||||
if (id.startsWith('.thumbnail')) {
|
||||
const thumbnail = await prisma.thumbnail.findFirst({
|
||||
where: {
|
||||
path: id,
|
||||
path: idSanitized,
|
||||
file: {
|
||||
password: null,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user