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
Merged

Links included in Drive exports #1695

merged 11 commits into from
Dec 12, 2024

Conversation

zuzanna-maria
Copy link
Contributor

www/common/make-backup.js Outdated Show resolved Hide resolved
@zuzanna-maria zuzanna-maria self-assigned this Oct 31, 2024
@zuzanna-maria zuzanna-maria linked an issue Nov 1, 2024 that may be closed by this pull request
@zuzanna-maria zuzanna-maria added the Ready to Review This PR is ready to be checked by another team member label Nov 1, 2024
@zuzanna-maria zuzanna-maria added Ready to Test This PR is ready to be tested and removed Ready to Review This PR is ready to be checked by another team member labels Nov 4, 2024
@mathilde-cryptpad mathilde-cryptpad added the Drive Anything related to CryptPad interface, not apps label Nov 4, 2024
@zuzanna-maria zuzanna-maria added OK to Merge This PR can be merged to staging and removed Ready to Test This PR is ready to be tested labels Dec 5, 2024
@yflory yflory added Ready to Test This PR is ready to be tested and removed OK to Merge This PR can be merged to staging labels Dec 5, 2024
Copy link
Contributor

@yflory yflory left a comment

Choose a reason for hiding this comment

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

While testing this PR, I noticed that links inside shared folders are missing from the exports (whether you download the entire shared folder or only a sub-folder inside the shared folder)

Comment on lines 362 to 364
Object.keys(links).forEach(function(key) {
filesData[key] = links[key];
});
Copy link
Contributor

Choose a reason for hiding this comment

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

You could avoid merge the data (and risking a conflict with ids) if you provide links as a 5th argument to makeFolder 5 lines below (line 369 when I'm writing this review).

Comment on lines 328 to 335
var fData = fd[el];
var sData = sd ? sd[el] : undefined;
if (fData) {
addFile(ctx, zip, fData, existingNames);
return;
} else if (sData) {
addFile(ctx, zip, sData, existingNames);
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine but you could simplify it with
var fData = fd[el] || (sd && sd[el]);
and remove the else if part

}
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.

Comment on lines 174 to 175
var linkRegex = new RegExp("^(http|https)://");
if (fData.href && linkRegex.test(fData.href)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should work but this isn't a very clean way to detect if this is a link. If someone created a pad at the very beginning of CryptPad and this pad's href wasn't properly migrated to the new format, it's possible that they still have a pad with an absolute URL in their drive https://cryptpad.fr/pad/#....
It's also possible that in the future we'll want to have absolute URL for pads stored at a different place.

Another way to detect if the item is a link is to simply check if channel exists:

if (!fData.channel) {
  // this is a link
} else {

@yflory yflory merged commit 3f378ae into staging Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Drive Anything related to CryptPad interface, not apps Ready to Test This PR is ready to be tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Links aren't parts of drive exports
4 participants