mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
fix(db): type the cleaned cookies for the strict compiler
This commit is contained in:
@@ -49,9 +49,12 @@ export function withoutEncodedNul(url: string): string {
|
||||
export function nulFreeRequest(req: Request, _res: Response, next: NextFunction): void {
|
||||
req.url = withoutEncodedNul(req.url);
|
||||
if (req.body !== undefined) req.body = nulFreeInput(req.body);
|
||||
const withCookies = req as Request & { cookies?: unknown; signedCookies?: unknown };
|
||||
if (withCookies.cookies !== undefined) withCookies.cookies = nulFreeInput(withCookies.cookies);
|
||||
if (withCookies.signedCookies !== undefined) withCookies.signedCookies = nulFreeInput(withCookies.signedCookies);
|
||||
const withCookies = req as Request & { cookies?: Record<string, unknown>; signedCookies?: Record<string, unknown> };
|
||||
if (withCookies.cookies !== undefined)
|
||||
withCookies.cookies = nulFreeInput(withCookies.cookies) as Record<string, unknown>;
|
||||
if (withCookies.signedCookies !== undefined) {
|
||||
withCookies.signedCookies = nulFreeInput(withCookies.signedCookies) as Record<string, unknown>;
|
||||
}
|
||||
next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user