Skip to content

Commit

Permalink
Handle JSON imports of actors and items with system.schema (foundry…
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam committed May 27, 2024
1 parent 4947aaf commit fe9229e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/module/doc-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ async function preImportJSON(json: string): Promise<string | null> {
ItemPF2e.migrateData(source);
}
}
if (!R.isPlainObject(source.system) || !R.isPlainObject(source.system._migration)) {
if (!R.isPlainObject(source.system)) return null;

if (R.isPlainObject(source.system.schema) && !R.isPlainObject(source.system._migration)) {
source.system._migration = { version: Number(source.system.schema.version) || null };
delete source.system.schema;
}

if (!R.isPlainObject(source.system._migration)) {
return null;
}

Expand Down

0 comments on commit fe9229e

Please sign in to comment.