Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d48c7b0

Browse filesBrowse files
committed
Changes how template file name case insensitivity is handled to address issue revel#729
1 parent 3ea29e3 commit d48c7b0
Copy full SHA for d48c7b0

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed

‎template.go

Copy file name to clipboardExpand all lines: template.go
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ func (loader *TemplateLoader) Refresh() *Error {
270270

271271
var fileStr string
272272

273-
// addTemplate allows the same template to be added multiple
274-
// times with different template names.
273+
// addTemplate loads a template file into the Go template loader so it can be rendered later
275274
addTemplate := func(templateName string) (err error) {
276275
TRACE.Println("adding template: ", templateName)
277276
// Convert template names to use forward slashes, even on Windows.
@@ -339,11 +338,7 @@ func (loader *TemplateLoader) Refresh() *Error {
339338

340339
templateName := path[len(fullSrcDir)+1:]
341340

342-
// Lower case the file name for case-insensitive matching
343-
lowerCaseTemplateName := strings.ToLower(templateName)
344-
345341
err = addTemplate(templateName)
346-
err = addTemplate(lowerCaseTemplateName)
347342

348343
// Store / report the first error encountered.
349344
if err != nil && loader.compileError == nil {
@@ -411,8 +406,13 @@ func parseTemplateError(err error) (templateName string, line int, description s
411406
// An Error is returned if there was any problem with any of the templates. (In
412407
// this case, if a template is returned, it may still be usable.)
413408
func (loader *TemplateLoader) Template(name string) (Template, error) {
414-
// Lower case the file name to support case-insensitive matching
409+
// Case-insensitive matching of template file name
415410
name = strings.ToLower(name)
411+
for k := range loader.templatePaths {
412+
if name == strings.ToLower(k) {
413+
name = k
414+
}
415+
}
416416
// Look up and return the template.
417417
tmpl := loader.templateSet.Lookup(name)
418418

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.