mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 05:26:26 +01:00
Former-commit-id: db3f5014cbc5148cfbe542ec69c2ff330677363b
This commit is contained in:
parent
cb634a037a
commit
3fdaa897ea
|
@ -3,6 +3,7 @@ package view
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/kataras/iris/core/errors"
|
"github.com/kataras/iris/core/errors"
|
||||||
)
|
)
|
||||||
|
@ -21,11 +22,10 @@ func (v *View) Register(e Engine) {
|
||||||
|
|
||||||
// Find receives a filename, gets its extension and returns the view engine responsible for that file extension
|
// Find receives a filename, gets its extension and returns the view engine responsible for that file extension
|
||||||
func (v *View) Find(filename string) Engine {
|
func (v *View) Find(filename string) Engine {
|
||||||
extension := filepath.Ext(filename)
|
|
||||||
// Read-Only no locks needed, at serve/runtime-time the library is not supposed to add new view engines
|
// Read-Only no locks needed, at serve/runtime-time the library is not supposed to add new view engines
|
||||||
for i, n := 0, len(v.engines); i < n; i++ {
|
for i, n := 0, len(v.engines); i < n; i++ {
|
||||||
e := v.engines[i]
|
e := v.engines[i]
|
||||||
if e.Ext() == extension {
|
if strings.HasSuffix(filename, e.Ext()) {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user