Compare commits

...

7 Commits

Author SHA1 Message Date
hugoreleaser 58b8245813 releaser: Bump versions for release of 0.104.3
[ci skip]
2022-10-04 14:25:23 +00:00
Bjørn Erik Pedersen ec57cf2c30 resources: Update golden image dithering exception list 2022-10-04 16:19:52 +02:00
Bjørn Erik Pedersen 3a9cb7b0fb resources/images: Fix 2 animated GIF resize issues
* Fix resize of animated GIF when target != GIF
* Avoid processing all GIF frames if targetFormat != GIF

Fixes #10354
2022-10-04 15:38:12 +02:00
Anthony Fok 0addb302ac server: Fix flaky TestServerPathEncodingIssues tests
Set getNumHomes: 1 to enable 567 ms or 2 s of wait for the server
to be ready in TestServerPathEncodingIssues/Unicode_paths and
TestServerPathEncodingIssues/Windows_multilingual_404.

Fixes #10332
2022-10-04 14:48:29 +02:00
Joe Mooring b002d47953 commands: Remove extraneous newline from result of convert toTOML
Fixes #10351
2022-10-04 09:28:34 +02:00
Ricardo N Feliciano e3f31352d4 config/security: Fix filename 2022-10-02 12:52:04 +02:00
hugoreleaser ec02c537ed releaser: Prepare repository for 0.105.0-DEV
[ci skip]
2022-09-29 10:47:15 +00:00
13 changed files with 39 additions and 32 deletions
+5 -11
View File
@@ -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,
},
)
+1 -1
View File
@@ -18,6 +18,6 @@ package hugo
var CurrentVersion = Version{
Major: 0,
Minor: 104,
PatchLevel: 2,
PatchLevel: 3,
Suffix: "",
}
+3 -2
View File
@@ -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
+1 -1
View File
@@ -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:
+4 -2
View File
@@ -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())
+1
View File
@@ -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.
+24 -15
View File
@@ -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())
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB