GDevelop
GDevelop copied to clipboard
Feat: Fix img hash tag preview issue in corsawareimage.js issue #4015
A simple fix for https://github.com/4ian/GDevelop/issues/4015 by encoding the url and removing special chars as recommended by the MDN page. here I also attached screen shots showing it now working and the break point showing full path with the # file name.
Hi! Thanks for the PR :)
Can you confirm images with a #
will also work when previewing and exporting a game, both on the desktop app and the web-app?
Also, is there a reason for not using the encodeURIComponent function - could there be other "special" characters like #
creating issues?
Not ready yet, found some issues.
@4ian I fixed the preview, that was something I thought was working but it wasn't that was my bad :). The export "worked" in that it exported them but there is an error in PIXI.JS when trying to view the game. It seems to encode the space but not the # so that is the same issue. Would that be an issue on PIXI.js repo ?? Or would you want the version we have modified? Sorry not my project so don't want to assume the workflow with vendor scripts.
Exported project running index.html on live server extension.
Any updates on this?
Sorry I missed the notification!
I would be interested to see what is needed to fix this in the game engine too, to ensure we have something working end to end... I've not been able to reflect a lot of this, but I wonder why we have to do a special handling of these characters and if there is something more complex (or more simple?) behind this 🤔
So part of the problem is that img tags and the way urls work. That was what I fixed but hashtags shouldn’t be in urls at all for files or most things. As they are used for internal anchors in the url schematic.
When I stepped through the breakpoints it seems pixi doesn’t encode urls either. Honestly all urls should be encoded regardless of solution just from best practices stand point and security.
It doesn’t help how many different things touch and use the url with no good linking between them. Trying to find the best place to encode it was tough too, but that I leave to my inexperience with the code base.