Repository: ambari
Updated Branches:
  refs/heads/trunk 2fee278f6 -> 6e758b76a


AMBARI-15176. New Files view: When the folder name has special characters, 
download and preview of files throws error. (dipayanb)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/965c42fb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/965c42fb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/965c42fb

Branch: refs/heads/trunk
Commit: 965c42fb69a6a3c593ada3c69a80b57b4cd76d5c
Parents: 2fee278
Author: Dipayan Bhowmick <[email protected]>
Authored: Fri Feb 26 15:46:41 2016 +0530
Committer: Dipayan Bhowmick <[email protected]>
Committed: Fri Feb 26 15:46:41 2016 +0530

----------------------------------------------------------------------
 .../files/src/main/resources/ui/app/services/file-preview.js | 8 ++++++--
 .../src/main/resources/ui/app/services/files-download.js     | 3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/965c42fb/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/files/src/main/resources/ui/app/services/file-preview.js 
b/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
index 2dc8558..7691e5e 100644
--- a/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
+++ b/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
@@ -66,9 +66,13 @@ export default Ember.Service.extend(FileOperationMixin, {
     var adapter = this.get('store').adapterFor('file');
     var baseURL = adapter.buildURL('file');
     var renameUrl = baseURL.substring(0, baseURL.lastIndexOf('/'));
-    var previewUrl = renameUrl.substring(0, renameUrl.lastIndexOf('/')) + 
"/preview/file?path=";
+    var previewUrl = renameUrl.substring(0, renameUrl.lastIndexOf('/')) + 
"/preview/file";
+    var queryParams = Ember.$.param({
+      path: this.get('selected.path'),
+      start: this.get('startIndex'),
+      end: this.get('endIndex')});
 
-    var currentFetchPath = previewUrl + this.get('selected.path') + '&start=' 
+ this.get('startIndex') + '&end=' + this.get('endIndex');
+    var currentFetchPath = previewUrl + "?" + queryParams;
 
     this.set('isLoading', true);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/965c42fb/contrib/views/files/src/main/resources/ui/app/services/files-download.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/files/src/main/resources/ui/app/services/files-download.js 
b/contrib/views/files/src/main/resources/ui/app/services/files-download.js
index 5b54bc0..7624b53 100644
--- a/contrib/views/files/src/main/resources/ui/app/services/files-download.js
+++ b/contrib/views/files/src/main/resources/ui/app/services/files-download.js
@@ -137,7 +137,8 @@ export default Ember.Service.extend(FileOperationMixin, {
   },
 
   _getDownloadUrl: function(path) {
-    return this._getDownloadBrowseUrl() + "?path=" + path + "&download=true";
+    let params = Ember.$.param({path: path, download: true});
+    return this._getDownloadBrowseUrl() + "?" + params;
   },
 
   _getConcatGenLinkUrl: function() {

Reply via email to