diff --git a/www/common/make-backup.js b/www/common/make-backup.js index cb6f5bf2b..50a62456d 100644 --- a/www/common/make-backup.js +++ b/www/common/make-backup.js @@ -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, diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index d79ed758d..fc30f8831 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -595,7 +595,9 @@ define([ }); }; + var privateData = common.getMetadataMgr().getPrivateData(); var ctx = { + fileHost: privateData.fileHost, get: common.getPad, sframeChan: sframeChan, }; diff --git a/www/file/inner.js b/www/file/inner.js index 6a78e5f45..1cbe3e8c3 100644 --- a/www/file/inner.js +++ b/www/file/inner.js @@ -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; diff --git a/www/settings/inner.js b/www/settings/inner.js index f92df0221..22ad7cc49 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -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 () {