|
2 | 2 | /* jshint eqeqeq: false, unused: false, expr: true */
|
3 | 3 |
|
4 | 4 | angular.module('openshiftConsole')
|
5 |
| -.factory('DataService', function($cacheFactory, $http, $ws, $rootScope, $q, API_CFG, APIService, Notification, Logger, $timeout) { |
| 5 | +.factory('DataService', function($cacheFactory, $http, $ws, $rootScope, $q, API_CFG, APIService, Notification, Logger, $timeout, base64, base64util) { |
6 | 6 |
|
7 | 7 | function Data(array) {
|
8 | 8 | this._data = {};
|
@@ -420,14 +420,6 @@ angular.module('openshiftConsole')
|
420 | 420 | return deferred.promise;
|
421 | 421 | };
|
422 | 422 |
|
423 |
| -// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa |
424 |
| -function utf8_to_b64( str ) { |
425 |
| - return window.btoa(window.unescape(encodeURIComponent( str ))); |
426 |
| -} |
427 |
| -function b64_to_utf8( str ) { |
428 |
| - return decodeURIComponent(window.escape(window.atob( str ))); |
429 |
| -} |
430 |
| - |
431 | 423 | // TODO (bpeterse): Create a new Streamer service & get this out of DataService.
|
432 | 424 | DataService.prototype.createStream = function(resource, name, context, opts, isRaw) {
|
433 | 425 | var self = this;
|
@@ -461,7 +453,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
|
461 | 453 |
|
462 | 454 | var message;
|
463 | 455 | if(!isRaw) {
|
464 |
| - message = b64_to_utf8(evt.data); |
| 456 | + message = base64.decode(base64util.pad(evt.data)); |
465 | 457 | // Count bytes for log streams, which will stop when limitBytes is reached.
|
466 | 458 | // There's no other way to detect we've reach the limit currently.
|
467 | 459 | cumulativeBytes += message.length;
|
|
0 commit comments