mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-15 17:56:02 +00:00
Fix: Microsoft office Bearer issue (#1461)
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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 === "") {
|
||||
|
||||
Reference in New Issue
Block a user