gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.73k stars 7.53k forks source link

hugo --minify causes panic #5261

Closed rdegges closed 6 years ago

rdegges commented 6 years ago

Hi there!

I'm building a simple Hugo blog. I've got it working great when I build it using the hugo command, but if I try to run hugo --minify I get a panic.

Here's some output

$ hugo         

                   |  EN   
+------------------+------+
  Pages            |  467  
  Paginator pages  |   16  
  Non-page files   |    0  
  Static files     | 1554  
  Processed images |    0  
  Aliases          |    1  
  Sitemaps         |    1  
  Cleaned          |    0

vs

$ hugo --minify
Building sites … panic: runtime error: slice bounds out of range

goroutine 132 [running]:
github.com/tdewolff/minify/html.(*Minifier).Minify(0xc000574f50, 0xc000870db0, 0x1132740, 0xc00018df80, 0x1132720, 0xc000c8bc00, 0x0, 0x0, 0x0)
        /go/pkg/mod/github.com/tdewolff/minify@v2.3.5+incompatible/html/html.go:92 +0x505f
github.com/tdewolff/minify.Minifier.Minify-fm(0xc000870db0, 0x1132740, 0xc00018df80, 0x1132720, 0xc000c8bc00, 0x0, 0x1135300, 0x1132720)
        /go/pkg/mod/github.com/tdewolff/minify@v2.3.5+incompatible/minify.go:114 +0x72
github.com/tdewolff/minify.MinifierFunc.Minify(0xc002cce780, 0xc000870db0, 0x1132740, 0xc00018df80, 0x1132720, 0xc000c8bc00, 0x0, 0xc00169ad00, 0xc000b7b580)
        /go/pkg/mod/github.com/tdewolff/minify@v2.3.5+incompatible/minify.go:29 +0x65
github.com/gohugoio/hugo/minifiers.Client.Transformer.func1(0x1136340, 0xc003455ae0, 0xc00018df80, 0x6bf1)
        /root/project/hugo/minifiers/minifiers.go:53 +0xde
github.com/gohugoio/hugo/transform.(*Chain).Apply(0xc000b7b780, 0x1132740, 0xc0009d01c0, 0x1132720, 0xc000c56b60, 0x0, 0x0)
        /root/project/hugo/transform/chain.go:105 +0x1c4
github.com/gohugoio/hugo/publisher.DestinationPublisher.Publish(0x1149340, 0xc0002c4bc0, 0x1, 0xc000870db0, 0x1132720, 0xc000c56b60, 0xefe96c, 0x4, 0xeffce0, 0x4, ...)
        /root/project/hugo/publisher/publisher.go:100 +0x36e
github.com/gohugoio/hugo/hugolib.(*Site).renderAndWritePage(0xc00026e000, 0xc0001e17d0, 0xc000af2230, 0x42, 0xc001c983c0, 0x51, 0xc002438500, 0xc00163c200, 0x10, 0x10, ...)
        /root/project/hugo/hugolib/site.go:1728 +0x300
github.com/gohugoio/hugo/hugolib.pageRenderer(0xc00026e000, 0xc0008d2300, 0xc0008d22a0, 0xc00165cc60)
        /root/project/hugo/hugolib/site_render.go:167 +0x71c
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
        /root/project/hugo/hugolib/site_render.go:41 +0x153

The source for my site can be found at: https://github.com/oktadeveloper/okta-blog

bep commented 6 years ago

It would help us a lot if you could register this issue also at:

https://github.com/tdewolff/minify/issues

I quickly scanned the code where the stack trace points, and this looks to be related to conditional IE statements.

moorereason commented 6 years ago

This issue has been fixed upstream, but it isn't in a tagged release yet. Current release is v2.3.5.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.