Fix: Microsoft office Bearer issue (#1461)

This commit is contained in:
Neal Shah
2025-08-22 14:01:28 -04:00
committed by GitHub
parent 76584b9f87
commit 64126179cc
3 changed files with 3 additions and 3 deletions
@@ -55,7 +55,7 @@ const configurable_auth = options => async (req, res, next) => {
if(req.body && req.body.auth_token)
token = req.body.auth_token;
// HTTML Auth header
else if (req.header && req.header('Authorization') && !req.header('Authorization').startsWith("Basic ")) {
else if (req.header && req.header('Authorization') && !req.header('Authorization').startsWith("Basic ") && req.header('Authorization') !== "Bearer") { // Bearer with no space is something office does
token = req.header('Authorization');
token = token.replace('Bearer ', '').trim();
if ( token === 'undefined' ) {
@@ -672,13 +672,13 @@ class WebServerService extends BaseService {
'MS-Author-Via': 'DAV', // Microsoft compatibility
'Server': 'Puter/WebDAV', // Server identification
'Accept-Ranges': 'bytes',
"Access-Control-Allow-Credentials": "true",
'Content-Type': 'text/plain; charset=utf-8', // Explicit content type
'Content-Length': '0',
'Cache-Control': 'no-cache', // Prevent caching issues
'Connection': 'Keep-Alive' // Keep connection alive for macOS
});
res.status(200).end();
console.log("OPTIONS request completed for macOS compatibility");
}
return res.sendStatus(200);
});
+1 -1
View File
@@ -1135,9 +1135,9 @@ class WebDavFS extends BaseService {
*/
handler: async (req, res) => {
const svc_su = this.services.get("su")
res.set({ "Access-Control-Allow-Credentials": "true"}) // allow cors auth
let actor = await handleHttpBasicAuth(req.actor, req, res);
if (!actor) return;
let filePath = decodeURIComponent(req.path)
// Handle root path for WebDAV compatibility
if (filePath === "/" || filePath === "") {