-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: WebP support for SEO post images #130
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
fix: WebP support for SEO post images #130
Conversation
Summary of ChangesHello @gocanto, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces support for WebP images, primarily targeting SEO post images. By integrating the WebP decoder and adding a comprehensive test case, the system can now correctly fetch and process WebP formatted images, which can lead to improved performance and SEO benefits. The changes ensure robust handling of WebP assets within the existing image processing infrastructure. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a robust image fetching/decoding pipeline with multi-encoding handling, AVIF/WebP support, diagnostics surfacing, and HTTP request adjustments. Introduces a DecodeError type with diagnostics, utilities/constants for images, expanded Save to WebP, and extensive tests. Updates go.mod to add direct x/image and new indirect deps for formats/VM. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as CLI Caller
participant IMG as images.Fetch
participant SRC as openSource
participant NET as HTTP/File
participant DEC as Decoders
participant Fallback as GitHub Fallback
CLI->>IMG: Fetch(url or path)
IMG->>SRC: Resolve source
SRC->>NET: GET / open file (Accept + UA + encodings)
NET-->>SRC: Response (body, Content-Type, Content-Encoding)
SRC-->>IMG: Readable body (+wrapHTTPBody for encoding)
IMG->>IMG: readLimited(payload, size cap)
alt Decode succeeds
IMG->>DEC: Try standard decode
DEC-->>IMG: image.Image
IMG-->>CLI: image + mime/ext
else Decode fails
IMG->>DEC: Try AVIF decode
alt AVIF ok
DEC-->>IMG: image.Image
IMG-->>CLI: image
else
IMG->>IMG: Try decompress (br/gzip/zstd/zlib)
IMG->>IMG: Trim noise / find embedded start
IMG->>DEC: Retry decode(s)
alt Still fails
IMG->>Fallback: githubAttachmentFallbacks (AVIF→PNG, etc.)
alt Fallback ok
Fallback-->>IMG: Decodable payload
IMG->>DEC: Decode
DEC-->>IMG: image.Image
IMG-->>CLI: image
else Fallback fails
IMG-->>CLI: error (*DecodeError with diagnostics)
end
else Decode ok
DEC-->>IMG: image.Image
IMG-->>CLI: image
end
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly adds WebP image support by registering the WebP decoder. A new regression test is included to verify that remote WebP images can be fetched and decoded. My review includes suggestions to improve the new test's robustness and maintainability by refining error handling within the test's HTTP handler and by externalizing test data.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68e8ab5a80988333bfde388849daa648
Summary by CodeRabbit