mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-13 18:45:43 +05:00
Links are now part of Drive exports #942
This commit is contained in:
parent
e40410eecb
commit
6fa7ea583f
@ -170,9 +170,17 @@ define([
|
||||
});
|
||||
}
|
||||
|
||||
var href = (fData.href && fData.href.indexOf('#') !== -1) ? fData.href : fData.roHref;
|
||||
var parsed = Hash.parsePadUrl(href);
|
||||
if (['pad', 'file'].indexOf(parsed.hashData.type) === -1) { return; }
|
||||
var href;
|
||||
var parsed;
|
||||
if (fData.href.indexOf('https') !== -1 && fData.href.indexOf('http') !== -1) {
|
||||
href = fData.href;
|
||||
parsed = {};
|
||||
parsed['hashData'] = {type: 'link'};
|
||||
} else {
|
||||
href = (fData.href && fData.href.indexOf('#') !== -1) ? fData.href : fData.roHref;
|
||||
parsed = Hash.parsePadUrl(href);
|
||||
}
|
||||
if (['pad', 'file', 'link'].indexOf(parsed.hashData.type) === -1) { return; }
|
||||
|
||||
// waitFor is used to make sure all the pads and files are process before downloading the zip.
|
||||
var w = ctx.waitFor();
|
||||
@ -220,7 +228,7 @@ define([
|
||||
var opts = {
|
||||
password: fData.password
|
||||
};
|
||||
var rawName = fData.filename || fData.title || 'File';
|
||||
var rawName = fData.filename || fData.title || fData.name || 'File';
|
||||
console.log(rawName);
|
||||
|
||||
// Pads (pad,code,slide,kanban,poll,...)
|
||||
@ -276,8 +284,21 @@ define([
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
var todoLink = function () {
|
||||
var opts = {
|
||||
binary: true,
|
||||
};
|
||||
var fileName = getUnique(sanitize(rawName), '.txt', existingNames);
|
||||
existingNames.push(fileName.toLowerCase());
|
||||
var content = new Blob([fData.href], { type : "text/html;charset=utf-8" });
|
||||
zip.file(fileName, content, opts);
|
||||
console.log('DONE ---- ' + fileName);
|
||||
setTimeout(done, 1000);
|
||||
};
|
||||
if (parsed.hashData.type === 'file') {
|
||||
return void todoFile();
|
||||
} else if (parsed.hashData.type === 'link') {
|
||||
return void todoLink();
|
||||
}
|
||||
todoPad();
|
||||
});
|
||||
@ -330,6 +351,10 @@ define([
|
||||
sframeChan: sframeChan
|
||||
};
|
||||
var filesData = data.sharedFolderId && ctx.sf[data.sharedFolderId] ? ctx.sf[data.sharedFolderId].filesData : ctx.data.filesData;
|
||||
var links = ctx.data.static;
|
||||
Object.keys(links).forEach(function(key) {
|
||||
filesData[key] = links[key];
|
||||
});
|
||||
progress('reading', -1); // Msg.settings_export_reading
|
||||
nThen(function (waitFor) {
|
||||
ctx.waitFor = waitFor;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user