Skip to content

Comments

add webp support#65

Merged
thraxil merged 4 commits intomasterfrom
webp
Feb 11, 2026
Merged

add webp support#65
thraxil merged 4 commits intomasterfrom
webp

Conversation

@thraxil
Copy link
Owner

@thraxil thraxil commented Feb 11, 2026

should close #57

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for the WebP image format to the Reticulum distributed image server. The implementation correctly updates the necessary encoder mappings and MIME type associations to enable WebP support throughout the system. According to issue #57, the underlying image processing library (bimg/libvips) already handles WebP files properly, so the changes primarily involve updating extension and MIME type mappings.

Changes:

  • Added WebP encoder using the nativewebp Go library
  • Updated MIME type and extension mappings to include WebP support
  • Added test coverage for WebP image handling
  • Applied code formatting improvements (struct field alignment, .PHONY directives)

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
encode.go Added encodeWEBP function and registered it in extencoders map
views.go Added WebP to mimeexts and extmimes mappings
image_specifier_test.go Added Test_Webp to verify WebP extension parsing
views_test.go Updated test context and added WebP test case
go.mod Added nativewebp and golang.org/x/image dependencies
go.sum Updated with checksums for new dependencies
config.go Applied struct field alignment formatting
worker.go Applied minor formatting improvements
Makefile Added .PHONY directives for build targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

encode.go Outdated
return gif.Encode(out, in, &gifOptions)
}

func encodeWEBP(out io.Writer, in image.Image) error {
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name encodeWEBP is inconsistent with the naming convention used for other encoder functions in this file. Other encoders use PascalCase (encodeJPEG, encodeGIF, encodePNG), but this uses all caps for WEBP. Consider renaming to encodeWebp or encodeWebP to match the existing pattern.

Copilot uses AI. Check for mistakes.
encode.go Outdated
".jpg": encodeJPEG,
".gif": encodeGIF,
".png": encodePNG,
".webp": encodeWEBP,
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reference should be updated to match the corrected encoder function name (either encodeWebp or encodeWebP) for consistency with the naming convention.

Copilot uses AI. Check for mistakes.
{"/image/0051ec03fb813e8731224ee06feee7c828ceae22//image.jpg", http.StatusNotFound},
{"/image/0051ec03fb813e8731224ee06feee7c828ceae22/100s/", http.StatusNotFound},
{"/image/0051ec03fb813e8731224ee06feee7c828ceae22/100s/image.jpeg", http.StatusMovedPermanently},
{"/image/0051ec03fb813e8731224ee06feee7c828ceae22/100s/image.webp", http.StatusOK},
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original test case for JPEG extension redirect behavior has been removed. The previous test verified that .jpeg files get redirected to .jpg (HTTP 301), which is an important behavior defined in views.go. Consider adding back the JPEG redirect test case in addition to the new WebP test case to maintain test coverage.

Copilot uses AI. Check for mistakes.
@thraxil
Copy link
Owner Author

thraxil commented Feb 11, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Feb 11, 2026

@thraxil I've opened a new pull request, #66, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 11, 2026 16:24
- Rename encodeWEBP to encodeWebP for consistency
- Update extencoders map reference
- Add back JPEG redirect test case

Co-authored-by: thraxil <7821+thraxil@users.noreply.github.com>
Co-authored-by: thraxil <7821+thraxil@users.noreply.github.com>
@thraxil thraxil merged commit 83d47f6 into master Feb 11, 2026
2 checks passed
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.

support webp extension

2 participants