fix: redirection accessing a folder without the final / was not compatible with vhosting plugin

Massimo Melina committed Feb 20, 2023 at 23:23 UTC 6d29c498ac82b42e7e65d94fb503d753f636917e
1 file changed +1 -1
src/middlewares.ts
+1 -1
@@ -119,7 +119,7 @@ export const serveGuiAndSharedFiles: Koa.Middleware = async (ctx, next) => {
119 const canRead = hasPermission(node, 'can_read', ctx)
120 const isFolder = await nodeIsDirectory(node)
121 if (isFolder && !path.endsWith('/'))
122 - return ctx.redirect(path + '/')
122 + return ctx.redirect(ctx.originalUrl + '/')
123 if (canRead && !isFolder)
124 return node.source ? serveFileNode(node)(ctx,next)
125 : next()