farirpgs / fari-app

The Free and Open-Source VTT

Home Page:https://fari.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Host crashes after receiving Sheet containing Emoji

zsinskri opened this issue · comments

I have one specific character sheet, that when changed by the player triggers the host's session to crash (showing an "Ooops! Looks like something went wrong" screen and disconnecting all players).

  • When the player assigns the sheet to their character, the host session crashes.
  • When the GM/host assigns the sheet to the players character, nothing crashes.
  • When the GM/host edits the assigned sheet, nothing crashes.
  • When the player edits the sheet, the host session crashes.

This behavior is the same, no matter whether the sheet was assigned as a duplicate or as the original, even persists ex- and import.
Other quite similar sheets (from the same game) do not induce crashes.

I found this stack trace in the hosts log:

vendor.ed4e22c4.js:39:34916

TypeError: e.sections.right is undefined
    getCharacterMainPointerBlock https://fari.app/assets/CharacterV3Dialog.80c9bae8.js:1
    getCharacterMainPointerBlock https://fari.app/assets/CharacterV3Dialog.80c9bae8.js:1
    _u https://fari.app/assets/CharacterV3Dialog.80c9bae8.js:1
    qa https://fari.app/assets/vendor.ed4e22c4.js:27
    Ps https://fari.app/assets/vendor.ed4e22c4.js:27
    Il https://fari.app/assets/vendor.ed4e22c4.js:27
    vu https://fari.app/assets/vendor.ed4e22c4.js:27
    pu https://fari.app/assets/vendor.ed4e22c4.js:27
    du https://fari.app/assets/vendor.ed4e22c4.js:27
    ou https://fari.app/assets/vendor.ed4e22c4.js:27
    Ai https://fari.app/assets/vendor.ed4e22c4.js:27
    unstable_runWithPriority https://fari.app/assets/vendor.ed4e22c4.js:18
    Mi https://fari.app/assets/vendor.ed4e22c4.js:27
    Ai https://fari.app/assets/vendor.ed4e22c4.js:27
    Ni https://fari.app/assets/vendor.ed4e22c4.js:27
    Zl https://fari.app/assets/vendor.ed4e22c4.js:27
    gs https://fari.app/assets/vendor.ed4e22c4.js:27
    y https://fari.app/assets/useSession.1ebd94a2.js:1
    onConnectionDataReceive https://fari.app/assets/PlayRoute.bd534d29.js:1
    r https://fari.app/assets/PlayRoute.bd534d29.js:1
    emit https://fari.app/assets/PlayRoute.bd534d29.js:1
    _handleDataMessage https://fari.app/assets/PlayRoute.bd534d29.js:1
    onmessage https://fari.app/assets/PlayRoute.bd534d29.js:1

    db https://fari.app/assets/vendor.ed4e22c4.js:39
    Gs https://fari.app/assets/vendor.ed4e22c4.js:27
    callback https://fari.app/assets/vendor.ed4e22c4.js:27
    ea https://fari.app/assets/vendor.ed4e22c4.js:27
    nl https://fari.app/assets/vendor.ed4e22c4.js:27
    yu https://fari.app/assets/vendor.ed4e22c4.js:27
    unstable_runWithPriority https://fari.app/assets/vendor.ed4e22c4.js:18
    Mi https://fari.app/assets/vendor.ed4e22c4.js:27
    mu https://fari.app/assets/vendor.ed4e22c4.js:27
    ou https://fari.app/assets/vendor.ed4e22c4.js:27
    Ai https://fari.app/assets/vendor.ed4e22c4.js:27
    unstable_runWithPriority https://fari.app/assets/vendor.ed4e22c4.js:18
    Mi https://fari.app/assets/vendor.ed4e22c4.js:27
    Ai https://fari.app/assets/vendor.ed4e22c4.js:27
    Ni https://fari.app/assets/vendor.ed4e22c4.js:27
    Zl https://fari.app/assets/vendor.ed4e22c4.js:27
    gs https://fari.app/assets/vendor.ed4e22c4.js:27
    y https://fari.app/assets/useSession.1ebd94a2.js:1
    onConnectionDataReceive https://fari.app/assets/PlayRoute.bd534d29.js:1
    r https://fari.app/assets/PlayRoute.bd534d29.js:1
    emit https://fari.app/assets/PlayRoute.bd534d29.js:1
    _handleDataMessage https://fari.app/assets/PlayRoute.bd534d29.js:1
    onmessage https://fari.app/assets/PlayRoute.bd534d29.js:1

I'd prefer not to share the actual sheet considering it contains information private to our game. (But might keep experimenting on my own.)

Oh, just found a minimal case: Emoji!

Join a game as a player and assign this character sheet containing a "🌞". For me at least, that causes this crash.

OK first of all, thanks for opening this, adding all those details and providing an example character sheet

This helped me troubleshoot the issue a lot faster.

So you are 100% correct, this is a problem. Fari uses encoding/decoding logic when sharing data between the GM and the players to handle things like emojis in character sheets and what not. This was implemented because of #160

But this logic wasn't used when the player sent data to the GM, only the other way around.

I have a fix and I'll deploy it to a preview environment later today.

Once its ready, would you mind doing a bit of testing and tell me if the issue is fixed ? It seems good on my local environment though!

Here's the preview environment https://1127916865--fari.netlify.app/

Yep, can no longer reproduce this issue inside your preview environment. Thanks for the quick fix!