Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58b8245813 | |||
| ec57cf2c30 | |||
| 3a9cb7b0fb | |||
| 0addb302ac | |||
| b002d47953 | |||
| e3f31352d4 | |||
| ec02c537ed |
@@ -25,7 +25,6 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/htesting"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
@@ -69,20 +68,14 @@ func TestServer404(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServerPathEncodingIssues(t *testing.T) {
|
||||
if htesting.IsGitHubAction() {
|
||||
// This test is flaky on CI for some reason. Run it on Windows only for now.
|
||||
// TODO(bep)
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Skip("Skipping test on CI")
|
||||
}
|
||||
}
|
||||
c := qt.New(t)
|
||||
|
||||
// Issue 10287
|
||||
c.Run("Unicode paths", func(c *qt.C) {
|
||||
r := runServerTest(c,
|
||||
serverTestOptions{
|
||||
pathsToGet: []string{"hügö/"},
|
||||
pathsToGet: []string{"hügö/"},
|
||||
getNumHomes: 1,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -123,8 +116,9 @@ status = 404
|
||||
`
|
||||
r := runServerTest(c,
|
||||
serverTestOptions{
|
||||
config: config,
|
||||
pathsToGet: []string{"en/this/does/not/exist", "es/this/does/not/exist"},
|
||||
config: config,
|
||||
pathsToGet: []string{"en/this/does/not/exist", "es/this/does/not/exist"},
|
||||
getNumHomes: 1,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -18,6 +18,6 @@ package hugo
|
||||
var CurrentVersion = Version{
|
||||
Major: 0,
|
||||
Minor: 104,
|
||||
PatchLevel: 2,
|
||||
PatchLevel: 3,
|
||||
Suffix: "",
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Release env.
|
||||
# These will be replaced by script before release.
|
||||
HUGORELEASER_TAG=v0.104.1
|
||||
HUGORELEASER_COMMITISH=8958b8741f552c8024af5194330fbf031544a826
|
||||
HUGORELEASER_TAG=v0.104.2
|
||||
HUGORELEASER_COMMITISH=84cbe724983b4b6153fd39aae0888cbb89a56cda
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ func InterfaceToFrontMatter(in any, format metadecoders.Format, w io.Writer) err
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = w.Write([]byte("\n" + tomlDelimLf))
|
||||
_, err = w.Write([]byte(tomlDelimLf))
|
||||
return err
|
||||
|
||||
default:
|
||||
|
||||
@@ -620,6 +620,8 @@ func TestImageOperationsGolden(t *testing.T) {
|
||||
|
||||
// Note, if you're enabling this on a MacOS M1 (ARM) you need to run the test with GOARCH=amd64.
|
||||
// GOARCH=amd64 go test -timeout 30s -run "^TestImageOperationsGolden$" ./resources -v
|
||||
// The above will print out a folder.
|
||||
// Replace testdata/golden with resources/_gen/images in that folder.
|
||||
devMode := false
|
||||
|
||||
testImages := []string{"sunset.jpg", "gohugoio8.png", "gohugoio24.png"}
|
||||
@@ -663,7 +665,7 @@ func TestImageOperationsGolden(t *testing.T) {
|
||||
|
||||
// Animated GIF
|
||||
orig = fetchImageForSpec(spec, c, "giphy.gif")
|
||||
for _, resizeSpec := range []string{"200x", "512x"} {
|
||||
for _, resizeSpec := range []string{"200x", "512x", "100x jpg"} {
|
||||
resized, err := orig.Resize(resizeSpec)
|
||||
c.Assert(err, qt.IsNil)
|
||||
rel := resized.RelPermalink()
|
||||
@@ -797,7 +799,7 @@ func assetGoldenDirs(c *qt.C, dir1, dir2 string) {
|
||||
case "gohugoio8_hu7f72c00afdf7634587afaa5eff2a25b2_73538_73c19c5f80881858a85aa23cd0ca400d.png",
|
||||
"gohugoio8_hu7f72c00afdf7634587afaa5eff2a25b2_73538_ae631e5252bb5d7b92bc766ad1a89069.png",
|
||||
"gohugoio8_hu7f72c00afdf7634587afaa5eff2a25b2_73538_d1bbfa2629bffb90118cacce3fcfb924.png",
|
||||
"giphy_hu3eafc418e52414ace6236bf1d31f82e1_52213_200x0_resize_box.gif":
|
||||
"giphy_hu3eafc418e52414ace6236bf1d31f82e1_52213_200x0_resize_box_1.gif":
|
||||
c.Log("expectedly differs from golden due to dithering:", fi1.Name())
|
||||
default:
|
||||
c.Errorf("resulting image differs from golden: %s", fi1.Name())
|
||||
|
||||
@@ -60,6 +60,7 @@ var (
|
||||
imageFormatsVersions = map[Format]int{
|
||||
PNG: 3, // Fix transparency issue with 32 bit images.
|
||||
WEBP: 2, // Fix transparency issue with 32 bit images.
|
||||
GIF: 1, // Fix resize issue with animated GIFs when target != GIF.
|
||||
}
|
||||
|
||||
// Increment to mark all processed images as stale. Only use when absolutely needed.
|
||||
|
||||
@@ -247,7 +247,7 @@ func (p *ImageProcessor) ApplyFiltersFromConfig(src image.Image, conf ImageConfi
|
||||
return nil, fmt.Errorf("unsupported action: %q", conf.Action)
|
||||
}
|
||||
|
||||
img, err := p.Filter(src, filters...)
|
||||
img, err := p.doFilter(src, conf.TargetFormat, filters...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -256,25 +256,34 @@ func (p *ImageProcessor) ApplyFiltersFromConfig(src image.Image, conf ImageConfi
|
||||
}
|
||||
|
||||
func (p *ImageProcessor) Filter(src image.Image, filters ...gift.Filter) (image.Image, error) {
|
||||
return p.doFilter(src, 0, filters...)
|
||||
}
|
||||
|
||||
func (p *ImageProcessor) doFilter(src image.Image, targetFormat Format, filters ...gift.Filter) (image.Image, error) {
|
||||
|
||||
filter := gift.New(filters...)
|
||||
|
||||
if giph, ok := src.(Giphy); ok && len(giph.GIF().Image) > 1 {
|
||||
if giph, ok := src.(Giphy); ok {
|
||||
g := giph.GIF()
|
||||
var bounds image.Rectangle
|
||||
firstFrame := g.Image[0]
|
||||
tmp := image.NewNRGBA(firstFrame.Bounds())
|
||||
for i := range g.Image {
|
||||
gift.New().DrawAt(tmp, g.Image[i], g.Image[i].Bounds().Min, gift.OverOperator)
|
||||
bounds = filter.Bounds(tmp.Bounds())
|
||||
dst := image.NewPaletted(bounds, g.Image[i].Palette)
|
||||
filter.Draw(dst, tmp)
|
||||
g.Image[i] = dst
|
||||
}
|
||||
g.Config.Width = bounds.Dx()
|
||||
g.Config.Height = bounds.Dy()
|
||||
if len(g.Image) < 2 || (targetFormat == 0 || targetFormat != GIF) {
|
||||
src = g.Image[0]
|
||||
} else {
|
||||
var bounds image.Rectangle
|
||||
firstFrame := g.Image[0]
|
||||
tmp := image.NewNRGBA(firstFrame.Bounds())
|
||||
for i := range g.Image {
|
||||
gift.New().DrawAt(tmp, g.Image[i], g.Image[i].Bounds().Min, gift.OverOperator)
|
||||
bounds = filter.Bounds(tmp.Bounds())
|
||||
dst := image.NewPaletted(bounds, g.Image[i].Palette)
|
||||
filter.Draw(dst, tmp)
|
||||
g.Image[i] = dst
|
||||
}
|
||||
g.Config.Width = bounds.Dx()
|
||||
g.Config.Height = bounds.Dy()
|
||||
|
||||
return giph, nil
|
||||
}
|
||||
|
||||
return giph, nil
|
||||
}
|
||||
|
||||
bounds := filter.Bounds(src.Bounds())
|
||||
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 304 KiB After Width: | Height: | Size: 304 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |