mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
a20c8e5371
* chore(deps): bump zod from 4.3.6 to 4.4.3 Bumps [zod](https://github.com/colinhacks/zod) from 4.3.6 to 4.4.3. - [Release notes](https://github.com/colinhacks/zod/releases) - [Commits](https://github.com/colinhacks/zod/compare/v4.3.6...v4.4.3) --- updated-dependencies: - dependency-name: zod dependency-version: 4.4.3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix: Make files.create file param optional in schema for zod 4.4 zod 4.4 changed z.custom() to reject undefined. Since validate runs before multipart injects the file, validation failed with 400 on all files.create requests. Mark the field optional and guard in the handler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Moor <tom@getoutline.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
1011 B
TypeScript
35 lines
1011 B
TypeScript
import type formidable from "formidable";
|
|
import { isEmpty } from "es-toolkit/compat";
|
|
import { z } from "zod";
|
|
import { ValidateKey } from "@server/validation";
|
|
|
|
export const FilesCreateSchema = z.object({
|
|
body: z.object({
|
|
key: z
|
|
.string()
|
|
.refine(ValidateKey.isValid, { message: ValidateKey.message })
|
|
.transform(ValidateKey.sanitize),
|
|
}),
|
|
file: z.custom<formidable.File>().optional(),
|
|
});
|
|
|
|
export type FilesCreateReq = z.infer<typeof FilesCreateSchema>;
|
|
|
|
export const FilesGetSchema = z.object({
|
|
query: z
|
|
.object({
|
|
key: z
|
|
.string()
|
|
.refine(ValidateKey.isValid, { message: ValidateKey.message })
|
|
.optional()
|
|
.transform((val) => (val ? ValidateKey.sanitize(val) : undefined)),
|
|
sig: z.string().optional(),
|
|
download: z.string().optional(),
|
|
})
|
|
.refine((obj) => !(isEmpty(obj.key) && isEmpty(obj.sig)), {
|
|
error: "One of key or sig is required",
|
|
}),
|
|
});
|
|
|
|
export type FilesGetReq = z.infer<typeof FilesGetSchema>;
|