mbrlabs/fileport

Crash

Opened this issue · 5 comments

2018/07/12 22:58:39 http: panic serving 192.168.36.251:56118: runtime error: invalid memory address or nil pointer dereference
goroutine 20 [running]:
net/http.(*conn).serve.func1(0xc42017e3c0)
        /usr/lib/go/src/net/http/server.go:1726 +0xd0
panic(0x727480, 0x96ade0)
        /usr/lib/go/src/runtime/panic.go:502 +0x229
html/template.(*Template).escape(0x0, 0x0, 0x0)
        /usr/lib/go/src/html/template/template.go:95 +0x2e
html/template.(*Template).Execute(0x0, 0x7cc900, 0xc4201f20e0, 0x7259e0, 0xc4201ce930, 0xc4201de1a4, 0x786e7d)
        /usr/lib/go/src/html/template/template.go:119 +0x2f
main.IndexHandler(0x7cf640, 0xc4201f20e0, 0xc4201e8700, 0x0, 0x0, 0x0)
        /home/genofire/projects/src/github.com/mbrlabs/fileport/routes.go:40 +0x2b8
github.com/mbrlabs/fileport/vendor/github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc420064200, 0x7cf640, 0xc4201f20e0, 0xc4201e
8700)
        /home/genofire/projects/src/github.com/mbrlabs/fileport/vendor/github.com/julienschmidt/httprouter/router.go:344 +0x770
net/http.serverHandler.ServeHTTP(0xc42007d450, 0x7cf640, 0xc4201f20e0, 0xc4201e8700)
        /usr/lib/go/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc42017e3c0, 0x7cf8c0, 0xc420176880)
        /usr/lib/go/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
        /usr/lib/go/src/net/http/server.go:2795 +0x27b

It couldn't find the login template. As of right now the template locations are specified relative to the project path (see templates.go).
How did you build and run it?

maybe - do you want to build it on a way without crashing? (with a own panic with a message)

(okay it works in our git path, maybe you like to have a config for paths like static and templates + a scope for the filemanager - not all files down till / )

Yeah, a config file is certainly makes sense. I used github.com/pelletier/go-toml a couple of times for similar setups.

Feel free to create a PR. I'm currently working on other projects but i would definitely merge this.

I have also a lot of projects ... so it will take some time, till i could spend time here