1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 12:50:55 +00:00

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
This commit is contained in:
Athurg Gooth 2014-12-25 11:23:04 +08:00
parent 0e1a0049d1
commit d961ae4cd8

View File

@ -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")