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

Add support for webp images to insert image flow #2285

Open
jpd236 opened this issue Oct 1, 2024 · 1 comment
Open

Add support for webp images to insert image flow #2285

jpd236 opened this issue Oct 1, 2024 · 1 comment

Comments

@jpd236
Copy link
Contributor

jpd236 commented Oct 1, 2024

Uploading .webp images via the "Insert image" flow seems to fail with an error in Document.methods.insertImage:

FetchError · invalid json response body at https://script.google.com/[snip] reason: Unexpected token < in JSON at position 0

A couple of users hit this with our test run via Galactic Puzzle Hunt. If it's not too much trouble, it seems like it would be nice to support this as it's becoming more prevalent.

@jpd236
Copy link
Contributor Author

jpd236 commented Oct 25, 2024

The app script is failing on line 132 (the call to sheet.insertImage) with the error "Error retrieving image from URL or bad URL". For whatever reason, despite the script failing, it returns an HTTP 200 response with an HTML-formatted error. So the failure mode is in trying to parse the response as JSON because it is supposedly "ok".

It's not explicitly stated, but I'm guessing that only PNG/GIF/JPG images are supported. For the short term, we can probably just restrict the formats on the upload/link side as well so the failure is clearer. Longer term, I suppose JR could convert images to a supported format before uploading.

Note that copy-pasting the image works just fine.

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

No branches or pull requests

1 participant