From 8eaa6ae683271e02b86a3530d8e4afdc8b8480d2 Mon Sep 17 00:00:00 2001 From: aritgithub Date: Mon, 26 Apr 2021 19:20:26 +0200 Subject: [PATCH] "base64binary" value error on generated handler Fixing of wrong logic of the control on the value type "base64binary"; it was always encoded in base16 (hexBinary) in the JavaScript handler of the generated html. --- js/event-handlers.xsl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/event-handlers.xsl b/js/event-handlers.xsl index 48be5c0..dd7456c 100644 --- a/js/event-handlers.xsl +++ b/js/event-handlers.xsl @@ -148,14 +148,14 @@ resetFilePicker(input); } else { input.setAttribute("value", - (type.endsWith(":base64binary")) + (type === "base64binary" || type.endsWith(":base64binary")) ? fileReader.result.substring(fileReader.result.indexOf(",") + 1) //convert base64 to base16 (hexBinary) : atob(fileReader.result.substring(fileReader.result.indexOf(",") + 1)) - .split('') - .map(function (aChar) { - return ('0' + aChar.charCodeAt(0).toString(16)).slice(-2); - }) + .split('') + .map(function (aChar) { + return ('0' + aChar.charCodeAt(0).toString(16)).slice(-2); + }) .join('') .toUpperCase() ); @@ -174,4 +174,4 @@ - \ No newline at end of file +