farirpgs / fari-app

The Free and Open-Source VTT

Home Page:https://fari.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import of malformed character sheet .json possible

maxschlosser opened this issue Β· comments

🚩 Describe the bug

It is possible to import character JSON that is missing the id field for at least one element.
The same applies to duplicate ids.

I already talked to @lynn0702 on Discord, who told me that missing or duplicate id will very likely lead to a broken UI and internal failures.

πŸ”’ Steps to reproduce

  1. Create a new character
  2. Import a template (e.g. Savage Worlds)
  3. Set a value
  4. Export the character to a JSON (sheet.json)
  5. Delete the character
  6. Edit sheet.json, either
    .. remove the id field of some elements
    .. edit two id fields to be the same
  7. Create a new character
  8. Import the modified sheet.json
  9. Export the imported character

Note: Steps 2 and 3 might not be necessary, but that is what I did.

🟒 Expected behavior

I would expect one of two behaviors if ids are missing or duplicate:

  1. The JSON is rejected with an error. An output on which field(s) caused the issue would be very useful but may not be feasible.
  2. The JSON is repaired with new unique ids.

πŸ”΄ Actual behavior

Fari accepts the import and generates what looks like a correctly formatted character sheet.
The ids are still missing or malformed when the sheet is exported again.

πŸ’… Screenshots

...

πŸ–₯ Desktop or Smartphone

  • OS: Windows 11
  • Browser: Firefox

πŸ“„ Additional context

Malformed Input:

If you can give me some pointers on where to start I could check if I can fix this myself. Looking for import surprisingly didn't turn up anything useful πŸ˜