backport fix to 0.5.1
This commit is contained in:
parent
f0f804ae76
commit
959e32cdcf
|
@ -1,4 +1,4 @@
|
||||||
from os.path import join, exists, isfile
|
from os.path import join, exists, isfile, abspath
|
||||||
|
|
||||||
import sanic.response as response
|
import sanic.response as response
|
||||||
from sanic.exceptions import NotFound
|
from sanic.exceptions import NotFound
|
||||||
|
@ -50,6 +50,9 @@ if INDEX_HTML and exists(INDEX_HTML):
|
||||||
raise NotFound()
|
raise NotFound()
|
||||||
|
|
||||||
file = join(app.config.FRONTEND_DIR, path)
|
file = join(app.config.FRONTEND_DIR, path)
|
||||||
|
if not abspath(file).startswith(abspath(app.config.FRONTEND_DIR)):
|
||||||
|
raise NotFound()
|
||||||
|
|
||||||
if not exists(file) or not path or not isfile(file):
|
if not exists(file) or not path or not isfile(file):
|
||||||
return response.html(
|
return response.html(
|
||||||
index_file_contents.replace("__BASE_HREF__", req.ctx.frontend_url + "/")
|
index_file_contents.replace("__BASE_HREF__", req.ctx.frontend_url + "/")
|
||||||
|
|
Loading…
Reference in a new issue