diff --git a/render/auto.go b/render/auto.go index 51f1c2e59..63e78db7d 100644 --- a/render/auto.go +++ b/render/auto.go @@ -7,7 +7,6 @@ import ( "io" "net/http" "path" - "path/filepath" "reflect" "strings" @@ -117,10 +116,10 @@ func (ir htmlAutoRenderer) Render(w io.Writer, data Data) error { } if data["method"] == "PUT" { - return ir.HTML(filepath.Join(templatePrefix.String(), "edit.html")).Render(w, data) + return ir.HTML(path.Join(templatePrefix.String(), "edit.html")).Render(w, data) } - return ir.HTML(filepath.Join(templatePrefix.String(), "new.html")).Render(w, data) + return ir.HTML(path.Join(templatePrefix.String(), "new.html")).Render(w, data) } return nil } @@ -128,7 +127,7 @@ func (ir htmlAutoRenderer) Render(w io.Writer, data Data) error { cp, ok := data["current_path"].(string) defCase := func() error { - return ir.HTML(filepath.Join(templatePrefix.String(), "index.html")).Render(w, data) + return ir.HTML(path.Join(templatePrefix.String(), "index.html")).Render(w, data) } if !ok { @@ -136,15 +135,15 @@ func (ir htmlAutoRenderer) Render(w io.Writer, data Data) error { } if strings.HasSuffix(cp, "/edit/") { - return ir.HTML(filepath.Join(templatePrefix.String(), "edit.html")).Render(w, data) + return ir.HTML(path.Join(templatePrefix.String(), "edit.html")).Render(w, data) } if strings.HasSuffix(cp, "/new/") { - return ir.HTML(filepath.Join(templatePrefix.String(), "new.html")).Render(w, data) + return ir.HTML(path.Join(templatePrefix.String(), "new.html")).Render(w, data) } if !isPlural { - return ir.HTML(filepath.Join(templatePrefix.String(), "show.html")).Render(w, data) + return ir.HTML(path.Join(templatePrefix.String(), "show.html")).Render(w, data) } return defCase() diff --git a/render/template_helpers.go b/render/template_helpers.go index 4cd8d567e..b7d177a98 100644 --- a/render/template_helpers.go +++ b/render/template_helpers.go @@ -4,6 +4,7 @@ import ( "encoding/json" "html/template" "io" + "path" "path/filepath" ht "github.com/gobuffalo/helpers/tags" @@ -49,7 +50,7 @@ func assetPathFor(file string) string { if filePath == "" || !ok { filePath = file } - return filepath.ToSlash(filepath.Join("/assets", filePath)) + return path.Join("/assets", filePath) } func loadManifest(manifest io.Reader) error { @@ -59,7 +60,9 @@ func loadManifest(manifest io.Reader) error { return err } for k, v := range m { - assetMap.Store(k, v) + // I don't think v has backslash but if so, correct them when + // creating the map instead using the value in `assetPathFor()`. + assetMap.Store(k, filepath.ToSlash(v)) } return nil }