From 8204d325388da797d37211dec6095694040ee713 Mon Sep 17 00:00:00 2001 From: Mathieu Cantin <41298167+mathcantin@users.noreply.github.com> Date: Thu, 10 Dec 2020 15:57:28 -0500 Subject: [PATCH] fix(configs): fix error with binary file (#3937) --- app/docker/models/config.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/docker/models/config.js b/app/docker/models/config.js index 0939c692b..0beb8f85c 100644 --- a/app/docker/models/config.js +++ b/app/docker/models/config.js @@ -1,14 +1,18 @@ import { ResourceControlViewModel } from 'Portainer/models/resourceControl/resourceControl'; function b64DecodeUnicode(str) { - return decodeURIComponent( - atob(str) - .split('') - .map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }) - .join('') - ); + try { + return decodeURIComponent( + atob(str) + .split('') + .map(function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + }) + .join('') + ); + } catch (err) { + return atob(str); + } } export function ConfigViewModel(data) {