P5.js-web-editor: loadImage() broken when using Editor with p5 0.10.2

Created on 17 Oct 2019  路  6Comments  路  Source: processing/p5.js-web-editor

Nature of issue?

  • Found a bug

Details about the bug:

  • Web browser and version: Chrome 77.0.3865
  • Operating System: Windows
  • Steps to reproduce this bug: Go to this example

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?

Most helpful comment

with some digging, i think it's related to #496... since response.headers.get('content-type') is null

All 6 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aparrish picture aparrish  路  5Comments

meiamsome picture meiamsome  路  4Comments

andytilia picture andytilia  路  4Comments

AltoRetrato picture AltoRetrato  路  4Comments

jeremydouglass picture jeremydouglass  路  4Comments