From cdd54680339c68a573b5c9767cfd60095ea1ffa7 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sat, 28 Oct 2017 13:38:40 -0700 Subject: [PATCH] catch QR code generation exceptions Error: code length overflow. (1748>1056) at Function.b.createData (qrcode.min.js:1) at b.makeImpl (qrcode.min.js:1) at b.getBestMaskPattern (qrcode.min.js:1) at b.make (qrcode.min.js:1) at QRCode.makeCode (qrcode.min.js:1) at new QRCode (qrcode.min.js:1) at parsexml (export-xml.html:114) at FileReader.reader.onload (export-xml.html:134) Signed-off-by: Etienne Champetier --- export-xml.html | 6 +++++- export.html | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/export-xml.html b/export-xml.html index 002f1f4..0f08447 100644 --- a/export-xml.html +++ b/export-xml.html @@ -110,7 +110,11 @@ uri='otpauth://'+j['type'].toLowerCase()+'/'+encodeURIComponent(label)+'?'+querydata(param); console.log(uri); document.getElementById("file").insertAdjacentHTML('afterend', '

'+name+'
' ); - new QRCode(document.getElementById(i),uri); + try { + new QRCode(document.getElementById(i),uri); + } catch(err) { + console.log(err); + } } } diff --git a/export.html b/export.html index 8663cbe..28e4fd9 100644 --- a/export.html +++ b/export.html @@ -113,7 +113,11 @@ uri='otpauth://'+j['type'].toLowerCase()+'/'+encodeURIComponent(label)+'?'+querydata(param); console.log(uri); document.getElementById("file").insertAdjacentHTML('afterend', '

'+name+'
' ); - new QRCode(document.getElementById(i),uri); + try { + new QRCode(document.getElementById(i),uri); + } catch(err) { + console.log(err); + } } }