d961ae4c by 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
1 parent 0e1a0049
...@@ -114,7 +114,7 @@ func (p *Paginator) Pages() []int { ...@@ -114,7 +114,7 @@ func (p *Paginator) Pages() []int {
114 114
115 // Returns URL for a given page index. 115 // Returns URL for a given page index.
116 func (p *Paginator) PageLink(page int) string { 116 func (p *Paginator) PageLink(page int) string {
117 link, _ := url.ParseRequestURI(p.Request.RequestURI) 117 link, _ := url.ParseRequestURI(p.Request.URL.String())
118 values := link.Query() 118 values := link.Query()
119 if page == 1 { 119 if page == 1 {
120 values.Del("p") 120 values.Del("p")
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!