1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

fix(volume-browser): download capability for all types of files (#2954)

This commit is contained in:
Pedro Henrique 2019-06-21 10:44:29 -03:00 committed by xAt0mZ
parent f3b9668629
commit 96f266adf6
3 changed files with 5 additions and 3 deletions

View file

@ -42,7 +42,7 @@ function (HttpRequestHelper, VolumeBrowserService, FileSaver, Blob, ModalService
var filePath = this.state.path === '/' ? file : this.state.path + '/' + file; var filePath = this.state.path === '/' ? file : this.state.path + '/' + file;
VolumeBrowserService.get(this.volumeId, filePath) VolumeBrowserService.get(this.volumeId, filePath)
.then(function success(data) { .then(function success(data) {
var downloadData = new Blob([data.file], { type: 'text/plain;charset=utf-8' }); var downloadData = new Blob([data.file]);
FileSaver.saveAs(downloadData, file); FileSaver.saveAs(downloadData, file);
}) })
.catch(function error(err) { .catch(function error(err) {

View file

@ -14,7 +14,8 @@ angular.module('portainer.agent')
}, },
get: { get: {
method: 'GET', params: { action: 'get' }, method: 'GET', params: { action: 'get' },
transformResponse: browseGetResponse transformResponse: browseGetResponse,
responseType: 'arraybuffer'
}, },
delete: { delete: {
method: 'DELETE', params: { action: 'delete' } method: 'DELETE', params: { action: 'delete' }

View file

@ -12,7 +12,8 @@ angular.module('portainer.agent')
}, },
get: { get: {
method: 'GET', params: { action: 'get' }, method: 'GET', params: { action: 'get' },
transformResponse: browseGetResponse transformResponse: browseGetResponse,
responseType: 'arraybuffer'
}, },
delete: { delete: {
method: 'DELETE', params: { action: 'delete' } method: 'DELETE', params: { action: 'delete' }