mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[editor-core] gracefully handle any legacy v1 import agent (#36354)
GitOrigin-RevId: 186afa70c03e69b3288af66d85a0a3e431780d14
This commit is contained in:
@@ -166,9 +166,9 @@ const rawFileMetadata = z.union([
|
||||
main: z.boolean(),
|
||||
importedAt: z.iso.datetime().optional(),
|
||||
}),
|
||||
// url import v1
|
||||
// legacy v1 linked file
|
||||
z.strictObject({
|
||||
agent: z.literal('url'),
|
||||
agent: z.string(),
|
||||
agentDataId: z.number(),
|
||||
importedAt: z.iso.datetime().optional(),
|
||||
}),
|
||||
|
||||
@@ -221,6 +221,14 @@ describe('schemas', function () {
|
||||
expect(result.success).to.equal(true)
|
||||
})
|
||||
|
||||
it('accepts a legacy v1 wlfile import', function () {
|
||||
const result = rawFileMetadata.safeParse({
|
||||
agent: 'wlfile',
|
||||
agentDataId: 1337,
|
||||
})
|
||||
expect(result.success).to.equal(true)
|
||||
})
|
||||
|
||||
it('accepts a legacy v1 main flag with an importedAt timestamp', function () {
|
||||
const result = rawFileMetadata.safeParse({
|
||||
main: true,
|
||||
|
||||
Reference in New Issue
Block a user