fix: plugin/vhosting: avoid double /
Massimo Melina committed
Jun 3, 2023 at 20:49 UTC
59e68ebc624ea506d0cc3d968e8284563dec8a8f
1 file changed
+6
-3
plugins/vhosting/plugin.js
+6
-3
@@ -1,5 +1,5 @@
1
exports.description = "If you want to have different home folders, based on domain"
2
-exports.version = 3.1 // support masks for host
2
+exports.version = 3.11
3
exports.apiRequired = 2 // 2 is for the config 'array'
4
5
exports.config = {
@@ -41,12 +41,15 @@ exports.init = api => {
41
}
42
return
43
}
44
+ let { root } = row
45
+ if (root.endsWith('/'))
46
+ root = root.slice(0, -1)
47
if (!params)
45
- ctx.path = row.root + ctx.path
48
+ ctx.path = root + ctx.path
49
else
50
for (const [k,v] of Object.entries(params))
51
if (k.startsWith('uri'))
49
- params[k] = row.root + v
52
+ params[k] = root + v
53
}
54
}
55
}