Fix downloading file from the drive

pull/1/head
yflory 5 years ago
parent a67f7d3edb
commit 3f6e64338a

@ -55,7 +55,7 @@ define([
var hash = parsed.hash;
var name = fData.filename || fData.title;
var secret = Hash.getSecrets('file', hash, fData.password);
var src = Hash.getBlobPathFromHex(secret.channel);
var src = (ctx.fileHost || '') + Hash.getBlobPathFromHex(secret.channel);
var key = secret.keys && secret.keys.cryptKey;
Util.fetch(src, function (err, u8) {
if (cancelled) { return; }
@ -266,10 +266,11 @@ define([
};
// Main function. Create the empty zip and fill it starting from drive.root
var create = function (data, getPad, cb, progress) {
var create = function (data, getPad, fileHost, cb, progress) {
if (!data || !data.uo || !data.uo.drive) { return void cb('EEMPTY'); }
var sem = Saferphore.create(5);
var ctx = {
fileHost: fileHost,
get: getPad,
data: data.uo.drive,
folder: data.folder || ctx.data.root,

@ -595,7 +595,9 @@ define([
});
};
var privateData = common.getMetadataMgr().getPrivateData();
var ctx = {
fileHost: privateData.fileHost,
get: common.getPad,
sframeChan: sframeChan,
};

@ -59,7 +59,7 @@ define([
var secret;
var metadataMgr = common.getMetadataMgr();
var priv = metadataMgr.getPrivateData();
var fileHost = priv.fileHost || priv.origin;
var fileHost = priv.fileHost || priv.origin || '';
if (!priv.filehash) {
uploadMode = true;

@ -1085,7 +1085,7 @@ define([
var todo = function (data, filename) {
var ui = createExportUI();
var bu = Backup.create(data, common.getPad, function (blob, errors) {
var bu = Backup.create(data, common.getPad, privateData.fileHost, function (blob, errors) {
saveAs(blob, filename);
sframeChan.event('EV_CRYPTGET_DISCONNECT');
ui.complete(function () {

Loading…
Cancel
Save