Skip to content

Commit

Permalink
fix: allow webp thumbnails (#758)
Browse files Browse the repository at this point in the history
* use webp as thumbnail

* simpler way to use webp

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
  • Loading branch information
Monirzadeh and fmartingr committed Oct 22, 2023
1 parent 1ae82f4 commit 03df5e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -34,6 +34,7 @@ require (
github.com/swaggo/swag v1.16.2
github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f
golang.org/x/crypto v0.13.0
golang.org/x/image v0.12.0
golang.org/x/net v0.15.0
golang.org/x/term v0.12.0
modernc.org/sqlite v1.26.0
Expand Down Expand Up @@ -86,7 +87,6 @@ require (
go.etcd.io/bbolt v1.3.7 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/image v0.12.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions internal/core/processing.go
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/go-shiori/shiori/internal/model"
"github.com/go-shiori/warc"
"github.com/pkg/errors"
_ "golang.org/x/image/webp"

// Add support for png
_ "image/png"
Expand Down Expand Up @@ -204,6 +205,7 @@ func DownloadBookImage(url, dstPath string) error {
if !strings.Contains(cp, "image/jpeg") &&
!strings.Contains(cp, "image/pjpeg") &&
!strings.Contains(cp, "image/jpg") &&
!strings.Contains(cp, "image/webp") &&
!strings.Contains(cp, "image/png") {
return ErrNoSupportedImageType
}
Expand Down

0 comments on commit 03df5e8

Please sign in to comment.