shithub: hugo

Download patch

ref: 4d708f096d5df64bf7309cbed67564d98c8e815a
parent: d2e022f2a7c3654cd1aaf24ea9134e61cb913cec
author: bep <[email protected]>
date: Wed Feb 18 16:51:32 EST 2015

Add revocer in LiveReloadInject

The panic cannot be reproduced, but add this as protection.

Fixes #911

--- a/transform/livereloadinject.go
+++ b/transform/livereloadinject.go
@@ -2,11 +2,16 @@
 
 import (
 	"bytes"
-
+	jww "github.com/spf13/jwalterweatherman"
 	"github.com/spf13/viper"
 )
 
 func LiveReloadInject(content []byte) []byte {
+	defer func() {
+		if r := recover(); r != nil {
+			jww.ERROR.Println("Recovered in LiveReloadInject", r)
+		}
+	}()
 	match := []byte("</body>")
 	port := viper.GetString("port")
 	replace := []byte(`<script>document.write('<script src="http://'