Return unmodified content if panic in LiveReloadInject
authorbep <bjorn.erik.pedersen@gmail.com>
Wed, 18 Feb 2015 21:16:40 +0000 (22:16 +0100)
committerbep <bjorn.erik.pedersen@gmail.com>
Wed, 18 Feb 2015 21:16:40 +0000 (22:16 +0100)
transform/livereloadinject.go

index 4f572b57c734e3f062bf8fccf51c0190079ad56f..eb431f14a35cf4cc59f798336d7c5aabc3024dac 100644 (file)
@@ -6,10 +6,11 @@ import (
        "github.com/spf13/viper"
 )
 
-func LiveReloadInject(content []byte) []byte {
+func LiveReloadInject(content []byte) (injected []byte) {
        defer func() {
                if r := recover(); r != nil {
                        jww.ERROR.Println("Recovered in LiveReloadInject", r)
+                       injected = content
                }
        }()
        match := []byte("</body>")