Fix plugin webapp URL cloning

This commit is contained in:
Tulir Asokan 2019-03-08 01:54:28 +02:00
parent d2b145d0bc
commit 74979aee1a

View File

@ -55,8 +55,9 @@ class MaubotServer:
async def handle_plugin_path(self, request: web.Request) -> web.Response: async def handle_plugin_path(self, request: web.Request) -> web.Response:
for path, app in self.plugin_routes.items(): for path, app in self.plugin_routes.items():
if request.path.startswith(path): if request.path.startswith(path):
request = request.clone( request = request.clone(rel_url=request.rel_url
rel_url=request.rel_url.with_path(request.rel_url.path[len(path):])) .with_path(request.rel_url.path[len(path):])
.with_query(request.query_string))
return await app.handle(request) return await app.handle(request)
return web.Response(status=404) return web.Response(status=404)