Skip to content

Commit

Permalink
Merge pull request #329 from SpiderOak/hive-path-fix
Browse files Browse the repository at this point in the history
Windows device fixes

(Looks like this includes the just-committed custom templates compilation branch, also.)
  • Loading branch information
kenmanheimer committed Sep 24, 2013
2 parents 4726d86 + b8e6640 commit c3c4b75
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/helpers/FileDownloadHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
});
fileTransfer.download(
options.from,
fileEntry.fullPath,
encodeURI(fileEntry.fullPath),
successCallback,
errorCallback,
false,
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/Migrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down
4 changes: 2 additions & 2 deletions src/models/HiveModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
13 changes: 6 additions & 7 deletions src/views/FilesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down Expand Up @@ -371,11 +371,10 @@
);
return; // return early
}
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")), "");
// Keep .shared path simple.. as they are not intentially stored.
// @TODO: Clean this up periodically?
path = "Download/" + s("SpiderOak") + "/.shared/" +
(spiderOakApp.accountModel.get("b32username") || "anonymous") + "/";
this.downloadFile(model, path, function(fileEntry) {
spiderOakApp.dialogView.hide();
this.shareViaIntent(fileEntry.fullPath);
Expand Down Expand Up @@ -577,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/")
Expand Down

0 comments on commit c3c4b75

Please sign in to comment.