1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-27 04:35:25 +00:00

Use route.fullPath when adding trailing slash

There's no need to specially construct the path.
This commit is contained in:
Asher 2020-04-02 11:32:19 -05:00
parent 411c61fb02
commit 498becd11f
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -49,14 +49,14 @@ export class ProxyHttpProvider extends HttpProvider implements HttpProxyProvider
}
// Ensure there is a trailing slash so relative paths work correctly.
const port = route.base.replace(/^\//, "")
const base = `${this.options.base}/${port}`
if (this.isRoot(route) && !route.fullPath.endsWith("/")) {
return {
redirect: `${base}/`,
redirect: `${route.fullPath}/`,
}
}
const port = route.base.replace(/^\//, "")
const base = `${this.options.base}/${port}`
const payload = this.doProxy(route, request, response, port, base)
if (payload) {
return payload