From 0d8a76593ab42febfb21019b52ca49f7d509fb3a Mon Sep 17 00:00:00 2001 From: Simon Laux Date: Wed, 21 Jun 2023 00:47:16 +0200 Subject: [PATCH] fix: make avatar image work on more platforms (use `xlink:href`) Without it delta touch (qt) can not render the avatar image and also inkscape does not show it either. --- src/qr_code_generator.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qr_code_generator.rs b/src/qr_code_generator.rs index bfd2b6a39..4fb9a2deb 100644 --- a/src/qr_code_generator.rs +++ b/src/qr_code_generator.rs @@ -121,6 +121,7 @@ fn inner_generate_secure_join_qr_code( w.elem("svg", |d| { d.attr("xmlns", "http://www.w3.org/2000/svg")?; d.attr("viewBox", format_args!("0 0 {width} {height}"))?; + d.attr("xmlns:xlink", "http://www.w3.org/1999/xlink")?; // required for enabling xlink:href on browsers Ok(()) })? .build(|w| { @@ -240,7 +241,7 @@ fn inner_generate_secure_join_qr_code( d.attr("preserveAspectRatio", "none")?; d.attr("clip-path", "url(#avatar-cut)")?; d.attr( - "href", /*might need xlink:href instead if it doesn't work on older devices?*/ + "xlink:href", /* xlink:href is needed otherwise it won't even display in inkscape not to mention qt's QSvgHandler */ format!( "data:image/jpeg;base64,{}", base64::engine::general_purpose::STANDARD.encode(img)