cstadther / adventure-import-export

A module for Foundy VTT for packaging and installing adventures.
MIT License
15 stars 7 forks source link

Fixes querystring parameter issue with file paths #115

Closed cmptrgeekken closed 3 years ago

cmptrgeekken commented 3 years ago

There is an issue with the current Importer implementation that results in the path generated on the file system including (incorrectly) any querystring present in the file path. This results in 404 Not Found errors when attempting to retrieve the image.

Example:

  1. Avatar path: actor/images/0FKncdMTp0uHEWsy/Ash_Zombie.Avatar.png?1607741617110
  2. Imported Path: .../actor/images/0FKncdMTp0uHEWsy/?1607741617110/Ash_Zombie.Avatar.png

This results in a 404 error when attempting to retrieve the image in the UI, as it was using the original path as a reference (without the querystring folder):

<!-- Sample -->
<img src="actor/images/0FKncdMTp0uHEWsy/Ash_Zombie.Avatar.png?1607741617110" />

This PR creates a separate targetPath variable for tracking where the file is stored on the file system, which strips out both the file name and the querystring parameter when verifying the folders.

cstadther commented 3 years ago

Thanks for this, When I test on my local and on aws my images don't include a querystring, but this definitely handles it if there is one.