it looks like the code https://hastebin.com/yivaterozi.js has been updated from using the deprecated $http.success() method to the current $http.then() . The Promise 'callback function (within the then method) receives only one object argument: https://docs.angularjs.org/api/ng/service/ $ http. The obsolete method of "success" received more arguments (data, status, headers) and data already contained raw data. When using then() data is located in the data property for the response, so try changing your call to $http to:
$http({ method: 'GET', cache: false, url: fileurl, responseType:'arraybuffer', headers: { 'Authorization': "Bearer " + $rootScope.userInfo.access_token, 'Access-Control-Allow-Origin': '*' } }).then(function (data) { var octetStreamMime = 'application/octet-stream'; var success = false;
note that the headers are retrieved here correctly from the data object, and not from the third argument (just add var since we removed the empty arguments). Now in every place where you use data, change it to data.data, for example:
// Try using msSaveBlob if supported var blob = new Blob([data.data], { type: contentType });
or simply change the argument data in response and add var data = response.data; anf change getter headers = response.headers(); to headers = response.headers(); :
$http({ method: 'GET', cache: false, url: fileurl, responseType:'arraybuffer', headers: { 'Authorization': "Bearer " + $rootScope.userInfo.access_token, 'Access-Control-Allow-Origin': '*' } }).then(function (response) { var octetStreamMime = 'application/octet-stream'; var success = false;
Andriy Feb 26 '17 at 10:17 2017-02-26 10:17
source share