phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.22k stars 7.1k forks source link

3.80.0 beta 2 - File.base64 check throws exception if url is not a string #6733

Closed yaustar closed 9 months ago

yaustar commented 9 months ago

On this line https://github.com/phaserjs/phaser/blob/a4d66864aecf94bccd8c94bcec94aad26ca00466/src/loader/File.js#L243

url maybe an object (like when use loader.multiatlas), it throws an exception. Should it check if it's string here first?

yaustar commented 9 months ago

To give a bit more context, we have the JSON data as an object when we call loader.multiatlas

loader.multiatlas("SOME_ID", {
          textures: [jsonObject],
        })

And this used to work in 3.70 but is not using the API correctly given the typings for multiatlas. However, File.url allows for it to be an object that has the results of parsing JSON data.

https://github.com/phaserjs/phaser/blob/a4d66864aecf94bccd8c94bcec94aad26ca00466/src/loader/File.js#L104

photonstorm commented 9 months ago

Thanks for opening this issue, and for submitting a PR to fix it. We have merged your PR into the master branch and attributed the work to you in the Change Log. If you need to tweak the code for whatever reason please submit a new PR.