Commit d961ae4c authored by Athurg Gooth's avatar Athurg Gooth

Fix RequestURI nil caused template parse failed

Sometime RequestURI is not set, e.g. running after a front proxy server.

We should always follow the document's directive, to use Request.URL instead of RequestURI.

Refer: http://golang.org/pkg/net/http/#Request
parent 0e1a0049
...@@ -114,7 +114,7 @@ func (p *Paginator) Pages() []int { ...@@ -114,7 +114,7 @@ func (p *Paginator) Pages() []int {
// Returns URL for a given page index. // Returns URL for a given page index.
func (p *Paginator) PageLink(page int) string { func (p *Paginator) PageLink(page int) string {
link, _ := url.ParseRequestURI(p.Request.RequestURI) link, _ := url.ParseRequestURI(p.Request.URL.String())
values := link.Query() values := link.Query()
if page == 1 { if page == 1 {
values.Del("p") values.Del("p")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment