From 035bed751217963619416111d1e8f154a5ddecba Mon Sep 17 00:00:00 2001 From: Anton Afanasyeu Date: Tue, 23 Jun 2026 19:08:41 +0200 Subject: [PATCH] auth: fix verify-email shorten guard; derive QR image URL from slug Use is_callable for ShortLinksRepository; build qr image URL when pack only has short_url (stale seed compatibility). Co-authored-by: Cursor --- src/AuthMailer.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/AuthMailer.php b/src/AuthMailer.php index 20e559d..f309e13 100644 --- a/src/AuthMailer.php +++ b/src/AuthMailer.php @@ -29,10 +29,17 @@ final class AuthMailer { $subject = 'Verify your Android Cast account'; $shortUrl = $verifyUrl; $qrImageUrl = null; - if (class_exists('ShortLinksRepository', false)) { + if (is_callable(['ShortLinksRepository', 'shortenForOutboundMail'])) { $pack = ShortLinksRepository::shortenForOutboundMail($verifyUrl, 86400); $shortUrl = (string) ($pack['short_url'] ?? $verifyUrl); $qrImageUrl = (string) ($pack['qr_image_url'] ?? ''); + if ($qrImageUrl === '' && preg_match('#/([a-f0-9]{6,16})$#', $shortUrl, $m)) { + $qrImageUrl = preg_replace( + '#/([a-f0-9]{6,16})$#', + '/api/v1/qr/' . $m[1] . '.png', + $shortUrl + ); + } if ($qrImageUrl === '') { $qrImageUrl = null; }