EddieDover / fvtt-player-achievements

A FoundryVTT module for Player Achievements.
GNU General Public License v3.0
1 stars 1 forks source link

in-chat achievement notification breaks with an absolute-url image #21

Closed SoulCookie closed 10 months ago

SoulCookie commented 10 months ago

Describe the bug Using a non-relative-path image URL for an achievement's Image breaks its in-chat "popup" display.

To Reproduce Steps to reproduce the behavior:

  1. Add/Edit Achievement
  2. [Select]
  3. Enter a non-relative URL (i.e. enter a URL that begins with http:// or https://)
  4. Save
  5. Trigger/award the achievement

Expected behavior The bug appears to be a superfluous trailing slash in the <img src> contained within the div.achievement-message-container. An image with a relative path seems to degrade gracefully, but a direct URL breaks.

The problematic line is likely line 107 of /src/module/fvtt-player-achievements.js -- I'm guessing wrapping quotes around the ${achievement.image} will keep the self-closing slash from being rendered inside the URL, though maybe even just adding a space between the } and the /> will work.

Screenshots foundry_mod-player-achievements_bug-trailing-slash-on-img-url_20231122a

Environment

Additional context The images are absolute URLs because of the way the Forge's account-wide Assets Library works.

EddieDover commented 10 months ago

@SoulCookie Thank you for the absolutely glorious bug report and for pinpointing the area that needed fixing.