Updates to resolve build issues
This commit is contained in:
@@ -17,7 +17,7 @@ const createBodySchema = z.object({
|
||||
const updateBodySchema = createBodySchema.partial();
|
||||
const idParamSchema = z.object({ id: z.string().uuid() });
|
||||
|
||||
export function foldersRouter(db: Database) {
|
||||
export function foldersRouter(db: Database): ReturnType<typeof Router> {
|
||||
const router = Router();
|
||||
|
||||
router.get('/', (_req: Request, res: Response) => {
|
||||
|
||||
@@ -23,7 +23,7 @@ const updateBodySchema = createBodySchema.partial();
|
||||
|
||||
const idParamSchema = z.object({ id: z.string().uuid() });
|
||||
|
||||
export function projectsRouter(db: Database, baseUrl: string) {
|
||||
export function projectsRouter(db: Database, baseUrl: string): ReturnType<typeof Router> {
|
||||
const router = Router();
|
||||
const toJson = (p: ReturnType<typeof getProject>) =>
|
||||
p
|
||||
|
||||
@@ -8,7 +8,7 @@ const bodySchema = z.object({
|
||||
customSlug: z.string().optional(),
|
||||
});
|
||||
|
||||
export function shortenRouter(env: Env) {
|
||||
export function shortenRouter(env: Env): ReturnType<typeof Router> {
|
||||
const router = Router();
|
||||
|
||||
router.post('/', async (req: Request, res: Response) => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import fs from 'fs';
|
||||
import type { Env } from '../env.js';
|
||||
import { createMulter } from '../upload.js';
|
||||
|
||||
export function uploadsRouter(env: Env, baseUrl: string) {
|
||||
export function uploadsRouter(env: Env, baseUrl: string): ReturnType<typeof Router> {
|
||||
const router = Router();
|
||||
const upload = createMulter(env);
|
||||
|
||||
@@ -18,7 +18,8 @@ export function uploadsRouter(env: Env, baseUrl: string) {
|
||||
});
|
||||
|
||||
router.get('/:filename', (req: Request, res: Response) => {
|
||||
const filename = req.params.filename;
|
||||
const raw = req.params.filename;
|
||||
const filename = typeof raw === 'string' ? raw : raw?.[0];
|
||||
if (!filename || filename.includes('..') || path.isAbsolute(filename)) {
|
||||
return res.status(400).json({ error: 'Invalid filename' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user