fix: legacy browsers accessing protected folders didn't get authentication request
Massimo Melina committed
Jun 16, 2024 at 18:28 UTC
1ddd3b5cf43dce7582846981f3a0c0e5d6b26d34
1 file changed
+1
-1
src/serveGuiAndSharedFiles.ts
+1
-1
@@ -113,7 +113,7 @@ export const serveGuiAndSharedFiles: Koa.Middleware = async (ctx, next) => {
113
// detect if we are dealing with a download-manager, as it may need basic authentication, while we don't want it on browsers
114
const { authenticate } = ctx.query
115
const downloadManagerDetected = /DAP|FDM|[Mm]anager/.test(ctx.get('user-agent'))
116
- if (downloadManagerDetected || authenticate)
116
+ if (downloadManagerDetected || authenticate || detectBasicAgent(ctx))
117
return ctx.set('WWW-Authenticate', authenticate || 'Basic') // basic authentication for DMs getting the folder as a zip
118
ctx.state.serveApp = true
119
return serveFrontendFiles(ctx, next)