fix: vhosting plugin was breaking the browse-files on Admin-panel
Massimo Melina committed
Feb 6, 2023 at 23:57 UTC
198dbe8e48f0a9c10d5c0be1dceeecf8f66748a4
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 // support masks for host
2
+exports.version = 3.1 // support masks for host
3
exports.apiRequired = 2 // 2 is for the config 'array'
4
5
exports.config = {
@@ -23,9 +23,12 @@ exports.init = api => {
23
middleware(ctx) {
24
let toModify = ctx
25
if (ctx.path.startsWith(api.const.SPECIAL_URI)) { // special uris should be excluded...
26
+ // ...unless it's a frontend api with a path param
27
+ if (!ctx.path.startsWith(api.const.API_URI) || ctx.params.path === undefined) return
28
+ let { referer } = ctx.headers
29
+ referer &&= new URL(referer).pathname
30
+ if (referer?.startsWith(api.const.ADMIN_URI)) return
31
toModify = ctx.params
27
- if (toModify?.path === undefined) // ...unless they carry a path in the query. In that case we'll work that.
28
- return
32
}
33
const hosts = api.getConfig('hosts')
34
if (!hosts?.length) return