From e93e7bf4b1715a08311b688a5fa3b51a0a1d3331 Mon Sep 17 00:00:00 2001 From: Tommy-Carlos Williams Date: Mon, 23 Sep 2013 11:10:14 +1000 Subject: [PATCH 1/3] Change `composedUrl` to use the abstracted s/ URL --- src/models/HiveModel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/HiveModel.js b/src/models/HiveModel.js index a2dded50..730b2105 100644 --- a/src/models/HiveModel.js +++ b/src/models/HiveModel.js @@ -25,8 +25,8 @@ } }, composedUrl: function(bare) { - var urlTail = encodeURI(this.get("device_path")); - var urlHead = this.url.replace("s\/","") + this.get("device_encoded"); + var urlTail = this.get("url"); + var urlHead = this.url; if (bare) { urlHead = urlHead && urlHead.split("?")[0]; urlTail = urlTail && urlTail.split("?")[0]; From e5421293d460c1d2ebf4b44cd3e54dbdb1eb1f49 Mon Sep 17 00:00:00 2001 From: Tommy-Carlos Williams Date: Tue, 24 Sep 2013 11:11:58 +1000 Subject: [PATCH 2/3] One more windows fix (not strictly hive related) --- src/helpers/FileDownloadHelper.js | 2 +- src/views/FilesView.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/helpers/FileDownloadHelper.js b/src/helpers/FileDownloadHelper.js index 953f0125..287399a6 100644 --- a/src/helpers/FileDownloadHelper.js +++ b/src/helpers/FileDownloadHelper.js @@ -75,7 +75,7 @@ }); fileTransfer.download( options.from, - fileEntry.fullPath, + encodeURI(fileEntry.fullPath), successCallback, errorCallback, false, diff --git a/src/views/FilesView.js b/src/views/FilesView.js index 416568e6..6a75ac60 100644 --- a/src/views/FilesView.js +++ b/src/views/FilesView.js @@ -371,11 +371,10 @@ ); return; // return early } + // Keep .shared path simple.. as they are not intentially stored. + // @TODO: Clean this up periodically? path = "Download/SpiderOak/.shared/" + - (spiderOakApp.accountModel.get("b32username") || "anonymous") + - model.composedUrl(true) - .replace(new RegExp("^.*(share|storage)\/([A-Z2-7]*)\/"), "/$1/$2/") - .replace(new RegExp(model.get("url")), ""); + (spiderOakApp.accountModel.get("b32username") || "anonymous") + "/"; this.downloadFile(model, path, function(fileEntry) { spiderOakApp.dialogView.hide(); this.shareViaIntent(fileEntry.fullPath); From b8e6640dcf19e973cd1d3acd3bc373df6c3bf8de Mon Sep 17 00:00:00 2001 From: Tommy-Carlos Williams Date: Tue, 24 Sep 2013 11:42:01 +1000 Subject: [PATCH 3/3] Adding this to the windows thing, though it's not really related But it probably hinges on changes and doing it here will avoid conflicts. --- src/helpers/Migrator.js | 4 ++-- src/views/FilesView.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/helpers/Migrator.js b/src/helpers/Migrator.js index 18749409..5e7d4333 100644 --- a/src/helpers/Migrator.js +++ b/src/helpers/Migrator.js @@ -50,14 +50,14 @@ var row = results.rows.item(i); var fileInfo = window.fileHelper.fileTypeFromExtension(row.name); // var path = row.localpath.replace( -// /^.*\/\.favorites/, "Download/SpiderOak/.favorites" +// /^.*\/\.favorites/, "Download/" + window.s("SpiderOak") + "/.favorites" // ); var b32username = ""; if (row.source && /\/storage\/[2-7A-Z]*\//.test(row.source)) { b32username = row.source .replace(/^.*\/storage\/([2-7A-Z]*)\/.*/,"$1"); } - var path = "Download/SpiderOak/.favorites/" + + var path = "Download/" + window.s("SpiderOak") + "/.favorites/" + (b32username || "anonymous") + row.fullpath .replace(new RegExp("^.*(share|storage)\/([A-Z2-7]*)\/"), "/$1/$2/") diff --git a/src/views/FilesView.js b/src/views/FilesView.js index 6a75ac60..c32d20b1 100644 --- a/src/views/FilesView.js +++ b/src/views/FilesView.js @@ -185,7 +185,7 @@ } var model = this.model; // Start by getting the folder path - var path = "Download/SpiderOak/.favorites/" + + var path = "Download/" + s("SpiderOak") + "/.favorites/" + (spiderOakApp.accountModel.get("b32username") || "anonymous") + model.composedUrl(true) .replace(new RegExp("^.*(share|storage)\/([A-Z2-7]*)\/"), "/$1/$2/") @@ -373,7 +373,7 @@ } // Keep .shared path simple.. as they are not intentially stored. // @TODO: Clean this up periodically? - path = "Download/SpiderOak/.shared/" + + path = "Download/" + s("SpiderOak") + "/.shared/" + (spiderOakApp.accountModel.get("b32username") || "anonymous") + "/"; this.downloadFile(model, path, function(fileEntry) { spiderOakApp.dialogView.hide(); @@ -576,7 +576,7 @@ refreshFavorite: function(callback) { var model = this.model; // @FIXME: This should be in a function and be based on platform - var path = "Download/SpiderOak/.favorites/" + + var path = "Download/" + s("SpiderOak") + "/.favorites/" + (spiderOakApp.accountModel.get("b32username") || "anonymous") + model.composedUrl(true) .replace(new RegExp("^.*(share|storage)\/([A-Z2-7]*)\/"), "/$1/$2/")