From f8442e9b981e2f76ddbb06f493bfdcfe3e262cea Mon Sep 17 00:00:00 2001 From: Fabrice Mouhartem Date: Thu, 13 Feb 2025 16:39:13 +0100 Subject: [PATCH] Fix anonymous full drive download - Related to #1782 - Anonymous full drive download is now working - One known false positive in the test that should not be too bad (the behaviour stays the same) --- www/common/make-backup.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/www/common/make-backup.js b/www/common/make-backup.js index 75bd19b78..4b4eaf723 100644 --- a/www/common/make-backup.js +++ b/www/common/make-backup.js @@ -353,6 +353,21 @@ define([ var filesData = data.sharedFolderId && ctx.sf[data.sharedFolderId] ? ctx.sf[data.sharedFolderId].filesData : ctx.data.filesData; var links = ctx.sf[data.sharedFolderId] && ctx.sf[data.sharedFolderId].static ? ctx.data.static && ctx.sf[data.sharedFolderId].static : ctx.data.static; + if (data.uo.curvePublic == undefined && Object.keys(ctx.data.root).length === 0) { + // Anonymous Drive + // In anonymous drive, there are no root folder in the data + // We are going to emulate it + // One false positive: empty team drive but the result is + // functionally equivalent + console.log("Anonymous drive"); // XXX: remove after testing phase + ctx.data.root = {}; + let index = 0; + Object.keys(ctx.data.filesData).forEach(file => { + ctx.data.root[index] = file; + index += 1; + }); + } + progress('reading', -1); // Msg.settings_export_reading nThen(function (waitFor) { ctx.waitFor = waitFor;