From d0247985488fe5a533728579be355e583908bf21 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Tue, 30 Jun 2026 23:17:28 -0700 Subject: [PATCH] fix: composite transparent QR uploads over white before jsQR decode --- webapp/src/components/vault/VaultEditor.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/src/components/vault/VaultEditor.tsx b/webapp/src/components/vault/VaultEditor.tsx index a052b6c..23c285b 100644 --- a/webapp/src/components/vault/VaultEditor.tsx +++ b/webapp/src/components/vault/VaultEditor.tsx @@ -181,6 +181,11 @@ export default function VaultEditor(props: VaultEditorProps) { canvas.height = height; const context = canvas.getContext('2d'); if (!context) return ''; + // jsQR ignores alpha and reads RGB directly, so transparent pixels would be + // treated as black. Composite over white first so transparent-background QR + // exports do not become black-on-black and fail to decode. + context.fillStyle = '#ffffff'; + context.fillRect(0, 0, width, height); context.drawImage(source, 0, 0, width, height); const imageData = context.getImageData(0, 0, width, height); return String(jsQR(imageData.data, width, height)?.data || '').trim();