-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
Conversation
zuzanna-maria
commented
Oct 28, 2024
- Links are now part of Drive exports (fixes Links aren't parts of drive exports #942)
There was a problem hiding this 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)
www/common/make-backup.js
Outdated
Object.keys(links).forEach(function(key) { | ||
filesData[key] = links[key]; | ||
}); |
There was a problem hiding this comment.
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).
www/common/make-backup.js
Outdated
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; |
There was a problem hiding this comment.
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
www/common/make-backup.js
Outdated
} | ||
if (ctx.data.sharedFolders[el]) { // if shared folder | ||
staticData = ctx.sf[el].static; |
There was a problem hiding this comment.
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.
www/common/make-backup.js
Outdated
var linkRegex = new RegExp("^(http|https)://"); | ||
if (fData.href && linkRegex.test(fData.href)) { |
There was a problem hiding this comment.
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 {