Closed daHaimi closed 4 years ago
The r.Auto renderer causes errors with Windows 10 and the most current version of gobuffalo.
r.Auto
On rendering a Resource's default method (e.g. UsersResource.List which should render the file users/index.plush.html) Leads to the Error
UsersResource.List
users/index.plush.html
users/index.html: could not find template users/index.html
This happens independently on 3 Windows installations, It does not happen on 6 Linux and i MacOS installation.
buffalo dev
We tried to solve it, replacing the line
return c.Render(200, r.Auto(c, users))
with
return c.Render(200, r.HTML("users" + string(os.PathSeparator) + "index"))
This actually mitigates the error, but loses of course the context, which prevents correct rendering if variables are bound.
A simple solution would be to change render/auto.go starting from line 110:
render/auto.go
switch data["method"] { case "PUT", "POST", "DELETE": if err := ir.redirect(pname, w, data); err != nil { if er, ok := err.(ErrRedirect); ok && er.Status >= http.StatusMultipleChoices && er.Status < http.StatusBadRequest { return err } if data["method"] == "PUT" { return ir.HTML(fmt.Sprintf("%s%cedit.html", templatePrefix, os.PathSeparator)).Render(w, data) } return ir.HTML(fmt.Sprintf("%s%cnew.html", templatePrefix, os.PathSeparator)).Render(w, data) } return nil } cp, ok := data["current_path"].(string) defCase := func() error { return ir.HTML(fmt.Sprintf("%s%c%s.html", templatePrefix, os.PathSeparator, "index")).Render(w, data) } if !ok { return defCase() } if strings.HasSuffix(cp, "/edit/") { return ir.HTML(fmt.Sprintf("%s%cedit.html", templatePrefix, os.PathSeparator)).Render(w, data) } if strings.HasSuffix(cp, "/new/") { return ir.HTML(fmt.Sprintf("%s%cnew.html", templatePrefix, os.PathSeparator)).Render(w, data) } if !isPlural { return ir.HTML(fmt.Sprintf("%s%cshow.html", templatePrefix, os.PathSeparator)).Render(w, data) } return defCase() }
It should Render the plush page
It produces an Error
Output of buffalo info: buffalo info.txt
buffalo info
Additional notes:
cmd
Covered in v0.16.4 thanks @daHaimi
Description
The
r.Auto
renderer causes errors with Windows 10 and the most current version of gobuffalo.On rendering a Resource's default method (e.g.
UsersResource.List
which should render the fileusers/index.plush.html
) Leads to the ErrorThis happens independently on 3 Windows installations, It does not happen on 6 Linux and i MacOS installation.
Steps to Reproduce the Problem
buffalo dev
on Windows 10 (Tested with git bash, )Steps to fix the problem
We tried to solve it, replacing the line
with
This actually mitigates the error, but loses of course the context, which prevents correct rendering if variables are bound.
A simple solution would be to change
render/auto.go
starting from line 110:Expected Behavior
It should Render the plush page
Actual Behavior
It produces an Error
Suggested Fix
Info
Output of
buffalo info
: buffalo info.txt