Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadImage() broken when using Editor with p5 0.10.2 #1196

Closed
stalgiag opened this issue Oct 17, 2019 · 6 comments
Closed

loadImage() broken when using Editor with p5 0.10.2 #1196

stalgiag opened this issue Oct 17, 2019 · 6 comments

Comments

@stalgiag
Copy link
Contributor

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?

@welcome
Copy link

welcome bot commented Oct 17, 2019

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.

@catarak
Copy link
Member

catarak commented Oct 17, 2019

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.

@stalgiag
Copy link
Contributor Author

The path is to a file uploaded to the web editor. In this example at least.

@catarak
Copy link
Member

catarak commented Oct 17, 2019

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

@stalgiag
Copy link
Contributor Author

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?

@catarak
Copy link
Member

catarak commented Oct 22, 2019

makes sense to me to get it fixed before updating the p5 version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants