Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links included in Drive exports #1695

Merged
merged 11 commits into from
Dec 12, 2024
Prev Previous commit
Next Next commit
Links in shared folders included in .zip
  • Loading branch information
zuzanna-maria committed Dec 6, 2024
commit 0b998a890dd4e5c86829fad2d97e0b2d70a60e93
10 changes: 8 additions & 2 deletions www/common/make-backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,26 +307,32 @@ define([
};

// Add folders and their content recursively in the zip
var makeFolder = function (ctx, root, zip, fd) {
var makeFolder = function (ctx, root, zip, fd, sd) {
if (typeof (root) !== "object") { return; }
var existingNames = [];
Object.keys(root).forEach(function (k) {
var el = root[k];
let staticData;
if (typeof el === "object" && el.metadata !== true) { // if folder
var fName = getUnique(sanitize(k), '', existingNames);
existingNames.push(fName.toLowerCase());
return void makeFolder(ctx, el, zip.folder(fName), fd);
}
if (ctx.data.sharedFolders[el]) { // if shared folder
staticData = ctx.sf[el].static;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staticData is only used inside this if. You could declare it here with let` directly.

var sfData = ctx.sf[el].metadata;
var sfName = getUnique(sanitize((sfData && sfData.title) || 'Folder'), '', existingNames);
existingNames.push(sfName.toLowerCase());
return void makeFolder(ctx, ctx.sf[el].root, zip.folder(sfName), ctx.sf[el].filesData);
return void makeFolder(ctx, ctx.sf[el].root, zip.folder(sfName), ctx.sf[el].filesData, staticData);
}
var fData = fd[el];
var sData = sd[el];
if (fData) {
addFile(ctx, zip, fData, existingNames);
return;
} else if (sData) {
addFile(ctx, zip, sData, existingNames);
return;
}
});
};
Expand Down