diff --git a/libraries/overleaf-editor-core/lib/file.js b/libraries/overleaf-editor-core/lib/file.js index 9c8eac4a96..cd4a7e60fe 100644 --- a/libraries/overleaf-editor-core/lib/file.js +++ b/libraries/overleaf-editor-core/lib/file.js @@ -129,9 +129,9 @@ class File { toStats() { const stats = this.data.toStats() if (!_.isEmpty(this.metadata)) { - stats.nMeta = 1 + stats.nMetadata = 1 // Note: Buffer does not exist in frontend. Use string length instead. - stats.metaSize = JSON.stringify(this.metadata).length + stats.metadataSize = JSON.stringify(this.metadata).length } return stats } diff --git a/services/history-v1/api/schema.js b/services/history-v1/api/schema.js index 0effaeb4ad..066e1861a9 100644 --- a/services/history-v1/api/schema.js +++ b/services/history-v1/api/schema.js @@ -5,11 +5,14 @@ const Blob = require('overleaf-editor-core').Blob const hexHashPattern = new RegExp(Blob.HEX_HASH_RX_STRING) -const fileSchema = z.object({ - hash: z.string().optional(), - byteLength: z.number().int().nullable().optional(), - stringLength: z.number().int().nullable().optional(), -}) +const fileSchema = z + .object({ + hash: z.string().optional(), + byteLength: z.number().int().nullable().optional(), + stringLength: z.number().int().nullable().optional(), + metadata: z.object({}).passthrough().optional(), + }) + .passthrough() const snapshotSchema = z.object({ files: z.record(z.string(), fileSchema),