diff --git a/packages/core/src/restic/restic-dto.ts b/packages/core/src/restic/restic-dto.ts index fd60c5ac..702596a8 100644 --- a/packages/core/src/restic/restic-dto.ts +++ b/packages/core/src/restic/restic-dto.ts @@ -30,13 +30,13 @@ export const resticBackupOutputSchema = resticBackupRunSummarySchema.extend({ }); export const resticBackupProgressMetricsSchema = z.object({ - seconds_elapsed: z.number(), + seconds_elapsed: z.number().default(0), seconds_remaining: z.number().default(0), percent_done: z.number(), total_files: z.number(), - files_done: z.number(), + files_done: z.number().default(0), total_bytes: z.number(), - bytes_done: z.number(), + bytes_done: z.number().default(0), current_files: z.array(z.string()).default([]), }); @@ -48,7 +48,7 @@ export const resticRestoreOutputSchema = z.object({ message_type: z.literal("summary"), total_files: z.number().optional(), files_restored: z.number(), - files_skipped: z.number(), + files_skipped: z.number().default(0), total_bytes: z.number().optional(), bytes_restored: z.number().optional(), bytes_skipped: z.number().optional(), diff --git a/packages/core/src/utils/path.ts b/packages/core/src/utils/path.ts index 2d7af102..61547086 100644 --- a/packages/core/src/utils/path.ts +++ b/packages/core/src/utils/path.ts @@ -32,6 +32,10 @@ export const normalizeAbsolutePath = (value?: string): string => { return "/"; } + if (normalized.length > 1000) { + throw new Error("Normalized path is too long"); + } + const withoutTrailingSlash = normalized.replace(/\/+$/, ""); if (!withoutTrailingSlash) { return "/";