I am using the web editor to host some examples for p5.xr, so I have been manually loading in v0.10.2 of p5 into the editor since it isn't default linked yet. This is lucky because in doing so, I found that loadImage() silently fails (or silently to the editor console, not to the browser console).
The error is :
TypeError: Cannot read property 'includes' of null
for this line. So fetchResponse.headers.get('content-type') is returning null. Note that this works when the sketch is run locally.
_Funny enough,_ I actually wrote the line that is giving the bug. I can fix it on the p5 side if that makes sense, but I am wondering if there is any idea over here as to why this would throw an error on the editor in specific?
Welcome! 馃憢 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.
when you're calling loadImage(), is the path to a file uploaded to the web editor, or is it hosted elsewhere? my instinct here is that it's a CORS issue that's throwing an error.
The path is to a file uploaded to the web editor. In this example at least.
with some digging, i think it's related to #496... since response.headers.get('content-type') is null
Oops! I should've caught that. Thanks for making the connection!
I am happy closing this as a duplicate but maybe I should make a note in the other issue pointing out that the issue should be resolved before updating the editor link to the latest version of p5 since the GIF feature relies on a content-type check?
makes sense to me to get it fixed before updating the p5 version!
Most helpful comment
with some digging, i think it's related to #496... since
response.headers.get('content-type')is null