Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add webp and svg support for images #1695

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

quinn
Copy link

@quinn quinn commented May 18, 2025

This PR does three things:

  • adds webp format support (one line change)
  • adds svg support (bulk of the PR)
  • Fixes frontend bug

The frontend bug is a one-line change, and happens in this scenario:

  • the mime magic detects the image as "image/whatever"
  • Go image decoder does not support the image format

This causes the indexer to enter a semi-broken state, where its identified the image as an image, but has not assigned it dimensions. If this file is then assigned as a camliContentImage, it will break, due to ccim.image being undefined.

@quinn
Copy link
Author

quinn commented May 18, 2025

I'd also be happy to try to fix the underlying issue with webp if someone can point me in the right direction, assuming thats the actual issue and i'm not doing something wrong with the uploader

@quinn
Copy link
Author

quinn commented May 19, 2025

added golang.org/x/image/webp package

@quinn quinn changed the title handle undefined image add webp support May 19, 2025
@quinn quinn changed the title add webp support add webp and svg support for images May 20, 2025
@quinn
Copy link
Author

quinn commented May 20, 2025

Updated to add support for displaying svg images

@quinn quinn mentioned this pull request May 20, 2025
@bradfitz
Copy link
Contributor

Some of the images I've loaded in have this attribute missing, which causes the home page to break.

"have this attribute missing"

What is "this"?

Can you squash these commits in this PR down to one commit and write a bit more of a commit message with backstory instead of just "handle undefined image" ?

@quinn quinn force-pushed the fix-missing-image branch from 472dd66 to 6c02363 Compare May 28, 2025 11:57
* adds webp format support (one line change)
* adds svg support (bulk of the changes)
* Fixes frontend bug

The frontend bug is a one-line change, and happens in this scenario:
* the mime magic detects the image as "image/whatever"
* Go image decoder does not support the image format

This causes the indexer to enter a semi-broken state, where its identified the image as an image, but has not assigned it dimensions. If this file is then assigned as a `camliContentImage`, it will break, due to `ccim.image` being undefined.
@quinn quinn force-pushed the fix-missing-image branch from 6c02363 to e802b4f Compare May 28, 2025 11:58
@quinn quinn requested a review from bradfitz May 28, 2025 11:59
@quinn
Copy link
Author

quinn commented May 28, 2025

@bradfitz Yeah, squashed / updated commit message, also updated PR description about what "undefined image" is referring to.

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

Successfully merging this pull request may close these issues.

2 participants