Updates to resolve build issues
This commit is contained in:
@@ -17,7 +17,7 @@ const createBodySchema = z.object({
|
|||||||
const updateBodySchema = createBodySchema.partial();
|
const updateBodySchema = createBodySchema.partial();
|
||||||
const idParamSchema = z.object({ id: z.string().uuid() });
|
const idParamSchema = z.object({ id: z.string().uuid() });
|
||||||
|
|
||||||
export function foldersRouter(db: Database) {
|
export function foldersRouter(db: Database): ReturnType<typeof Router> {
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get('/', (_req: Request, res: Response) => {
|
router.get('/', (_req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const updateBodySchema = createBodySchema.partial();
|
|||||||
|
|
||||||
const idParamSchema = z.object({ id: z.string().uuid() });
|
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 router = Router();
|
||||||
const toJson = (p: ReturnType<typeof getProject>) =>
|
const toJson = (p: ReturnType<typeof getProject>) =>
|
||||||
p
|
p
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const bodySchema = z.object({
|
|||||||
customSlug: z.string().optional(),
|
customSlug: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function shortenRouter(env: Env) {
|
export function shortenRouter(env: Env): ReturnType<typeof Router> {
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.post('/', async (req: Request, res: Response) => {
|
router.post('/', async (req: Request, res: Response) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import fs from 'fs';
|
|||||||
import type { Env } from '../env.js';
|
import type { Env } from '../env.js';
|
||||||
import { createMulter } from '../upload.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 router = Router();
|
||||||
const upload = createMulter(env);
|
const upload = createMulter(env);
|
||||||
|
|
||||||
@@ -18,7 +18,8 @@ export function uploadsRouter(env: Env, baseUrl: string) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get('/:filename', (req: Request, res: Response) => {
|
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)) {
|
if (!filename || filename.includes('..') || path.isAbsolute(filename)) {
|
||||||
return res.status(400).json({ error: 'Invalid filename' });
|
return res.status(400).json({ error: 'Invalid filename' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ['next/core-web-vitals', 'prettier'],
|
extends: ['next/core-web-vitals', 'prettier'],
|
||||||
|
plugins: ['@typescript-eslint'],
|
||||||
parserOptions: { ecmaVersion: 2022, sourceType: 'module' },
|
parserOptions: { ecmaVersion: 2022, sourceType: 'module' },
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
||||||
|
|||||||
Reference in New Issue
Block a user