normpath is now used before loading templates

This commit is contained in:
Armin Ronacher 2010-08-09 15:16:02 +02:00
parent 38107c752c
commit a3a843999b
4 changed files with 14 additions and 0 deletions

View file

@ -8,6 +8,7 @@
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import posixpath
from jinja2 import BaseLoader, TemplateNotFound
from .globals import _request_ctx_stack
@ -36,6 +37,9 @@ class _DispatchingJinjaLoader(BaseLoader):
self.app = app
def get_source(self, environment, template):
template = posixpath.normpath(template)
if template.startswith('../'):
raise TemplateNotFound(template)
loader = None
try:
module, name = template.split('/', 1)