Skip to content

Commit

Permalink
Fix the route reditect on non empty entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 19, 2019
1 parent fe13305 commit 448215e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions geoportal/c2cgeoportal_geoportal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def handle(event: InvalidateCacheEvent): # pylint: disable=unused-variable
config.add_route("oldapihelp", "/oldapihelp.html", request_method="GET")
config.add_route("oldxapihelp", "/oldxapihelp.html", request_method="GET")
c2cgeoportal_geoportal.views.add_redirect(
config, 'oldapijs_redirect', '/wsgi/api.js', '/apijs'
config, 'oldapijs_redirect', '/wsgi/api.js', 'apijs'
)

# Cannot be at the header to do not load the model too early
Expand All @@ -513,7 +513,7 @@ def add_api_route(name: str, attr: str, path: str, renderer: str):
add_api_route('apicss', 'apicss', '/api.css', "build/api.css")
add_api_route('apihelp', 'apihelp', '/apihelp/index.html', "api/apihelp/index.html")
c2cgeoportal_geoportal.views.add_redirect(
config, 'apihelp_redirect', '/apihelp.html', '/apihelp/index.html'
config, 'apihelp_redirect', '/apihelp.html', 'apihelp'
)

config.add_route(
Expand Down
2 changes: 1 addition & 1 deletion geoportal/c2cgeoportal_geoportal/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def add_ending_slash(request):
def add_redirect(config, name, from_, to):
def redirect_view(request):
del request # unused
return HTTPFound(location=to)
return HTTPFound(location=request.route_url(to))

config.add_route(name, from_, request_method='GET')
config.add_view(redirect_view, route_name=name)

0 comments on commit 448215e

Please sign in to comment.