~elektito/hodhod

ecd69cdbf454097c3d3acf8eee162a0513c9743f — Mostafa Razavi 1 year, 2 months ago 8233bf2 master
Fix possible crash
1 files changed, 2 insertions(+), 2 deletions(-)

M pkg/hodhod/static.go
M pkg/hodhod/static.go => pkg/hodhod/static.go +2 -2
@@ 74,10 74,10 @@ func NewFileResp(filename string, req Request, cfg *Config) (resp Response) {
	}

	u := *req.Url
	if isDir && u.Path[len(u.Path)-1] != '/' {
	if isDir && u.Path != "" && u.Path[len(u.Path)-1] != '/' {
		u.Path = u.Path + "/"
		return NewPermRedirectResp(u.String())
	} else if !isDir && u.Path[len(u.Path)-1] == '/' {
	} else if !isDir && u.Path != "" && u.Path[len(u.Path)-1] == '/' {
		u.Path = u.Path[:len(u.Path)-1]
		return NewPermRedirectResp(u.String())
	}