diff options
-rw-r--r-- | controller/translationcontroller.php | 1 | ||||
-rw-r--r-- | js/app/directives/iconpicker.js | 16 |
2 files changed, 8 insertions, 9 deletions
diff --git a/controller/translationcontroller.php b/controller/translationcontroller.php index fc7d7458..8d5f613f 100644 --- a/controller/translationcontroller.php +++ b/controller/translationcontroller.php @@ -145,6 +145,7 @@ class TranslationController extends ApiController { 'use.icon' => $this->trans->t('Use this icon'), 'use.icon.delete' => $this->trans->t('Delete current icon'), 'use.icon.refresh' => $this->trans->t('Get icon from page'), + 'use.icon.refresh.error' => $this->trans->t('There was an error fetching the icon!'), 'selected.icon' => $this->trans->t('Selected icon'), // templates/views/partials/edit_credential/custom_fields.html diff --git a/js/app/directives/iconpicker.js b/js/app/directives/iconpicker.js index 185624c7..0992bc54 100644 --- a/js/app/directives/iconpicker.js +++ b/js/app/directives/iconpicker.js @@ -30,7 +30,7 @@ * # passwordGen */ angular.module('passmanApp').directive('iconPicker', [ - '$window', 'IconService', '$http', function($window, IconService, $http) { + '$window', 'IconService', '$http', 'NotificationService','$translate', function($window, IconService, $http, NotificationService, $translate) { return { templateUrl: 'views/partials/icon-picker.html', restrict: 'A', @@ -118,14 +118,12 @@ scope.refreshUrlIcon = function(){ var queryUrl = OC.generateUrl('apps/passman/api/v2/geticon/'+btoa(scope.credential.url)); $http.get(queryUrl).then(function (response) { - - scope.customIcon = {}; - scope.customIcon.data='data:image/'+response.data.type+';base64,'+response.data.content; - if (response.data) { - return response.data; - } else { - return response; - } + if(typeof response.data.content !== 'undefined'){ + scope.customIcon = {}; + scope.customIcon.data='data:image/'+response.data.type+';base64,'+response.data.content; + }else{ + NotificationService.showNotification($translate.instant('use.icon.refresh.error'), 5000); + } }); }; |