From 285bcd431585ffb5526268bc60bc3a73eff9a7e5 Mon Sep 17 00:00:00 2001 From: Anna Claire Fields <58918237+franklovefrank@users.noreply.github.com> Date: Fri, 21 Aug 2026 16:34:16 +0200 Subject: [PATCH] [editor-core] accept the legacy source_project_display_name on project_file (#36837) GitOrigin-RevId: bebbba328ecdd04ac4df06f66e6b0b1f8a41276f --- libraries/overleaf-editor-core/lib/schemas.js | 4 ++++ .../overleaf-editor-core/test/unit/schemas.test.js | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/libraries/overleaf-editor-core/lib/schemas.js b/libraries/overleaf-editor-core/lib/schemas.js index a400222737..6c441a8f16 100644 --- a/libraries/overleaf-editor-core/lib/schemas.js +++ b/libraries/overleaf-editor-core/lib/schemas.js @@ -105,6 +105,10 @@ const rawLinkedFileData = z.discriminatedUnion('provider', [ source_project_id: zz.objectId().optional(), v1_source_doc_id: z.number().optional(), source_entity_path: z.string(), + // written by the linked-file agents until 2018 (removed in ebe828aa625) + // and never since; still present in the history of projects that linked a + // file before then, so it has to be tolerated when replaying changes. + source_project_display_name: z.string().optional(), importedAt: z.iso.datetime().optional(), }), z.strictObject({ diff --git a/libraries/overleaf-editor-core/test/unit/schemas.test.js b/libraries/overleaf-editor-core/test/unit/schemas.test.js index c2103c8c76..1c823b44e5 100644 --- a/libraries/overleaf-editor-core/test/unit/schemas.test.js +++ b/libraries/overleaf-editor-core/test/unit/schemas.test.js @@ -111,6 +111,17 @@ describe('schemas', function () { expect(result.success).to.equal(true) }) + it('accepts a project_file provider with a legacy display name', function () { + const result = rawLinkedFileData.safeParse({ + provider: 'project_file', + v1_source_doc_id: 1234, + source_entity_path: '/main.tex', + source_project_display_name: 'My linked project', + importedAt: '2017-05-04T00:00:00.000Z', + }) + expect(result.success).to.equal(true) + }) + it('rejects a project_file provider with a malformed source_project_id', function () { const result = rawLinkedFileData.safeParse({ provider: 'project_file',