Forien / foundryvtt-forien-quest-log

This module provides comprehensive Quest Log system for players and Game Masters to use with Foundry Virtual Tabletop
MIT License
21 stars 34 forks source link

[BUG] Corrupted journal entries while debugging. #120

Open rbarkoch opened 3 years ago

rbarkoch commented 3 years ago

Module Version: v0.5.7

Describe the bug The JSON parser for the quest does not strip HTML tags from the "content" section before parsing. This causes quest entry corruption whenever the quest entry is modified with the built-in journal editor.

When the quest entry is manually modified to try and correct for errors using the built-in journal editor, the journal entry will be saved with paragraph tags at the start and end of the content (....."content":"<p>{\"giver\":\" .......... }</p>). When the JSON parser tries to parse this content, the module fails and produces an error for Unexpected Token '<'.

This occurs even if you try to use TinyMCE to modify the source code of the journal entry. It still adds the

tags to the start and end for some reason. Presumably the tags could be something else depending on the content.

To Reproduce Steps to reproduce the behavior:

  1. Enable the debugging option for the module to view quest logs as journal entries.
  2. Open a quest journal entry.
  3. Modify the journal entry and save.
  4. Restart the server.
  5. Try and open the quest log. See console for error.

Expected behavior The quest parser should strip HTML tags from the "content" section of the start and end of the quest entry before attempting to parse the JSON content. If it encounters HTML tags, it should resave the quest entry automatically to the correct format.

This will allow for correcting bugs in the module via the standard Journal Entry editor in Foundry.

Browser: Google Chrome

Foundry Version: 0.7.9

Game System: D&D 5e

Additional context If you encounter this error, you can correct this problem by going into your worlds data folder and editing the "journal.db" file in any text editor and remove the HTML tags from the start and end of the "content" section for the journal entry relating to the quest.

I encountered this after coming across another bug where deleting a sub-quest resulted in an empty sub-quest entry under the main quests "Manage Quest" which could not be edited or removed. I was forced to try and manually correct the journal entry for the quest to remove the empty slot. When I used the built-in journal editor to edit the JSON, I ran into this error.