Fix event branding images broken by legacy QR redirect.
Deploy Ladill Events / deploy (push) Successful in 25s

Keep logo and cover asset URLs on Events instead of redirecting them to
ladl.link, which does not serve uploaded QR storage files.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-02 08:14:17 +00:00
co-authored by Cursor
parent 32c721b4f2
commit d942ebaa83
2 changed files with 88 additions and 0 deletions
@@ -9,6 +9,23 @@ use Symfony\Component\HttpFoundation\Response;
class RedirectLegacyQrToLadillLink
{
/** @var list<string> */
private const STORAGE_ASSET_SUFFIXES = [
'event-logo',
'event-cover',
'itinerary-cover',
'business-logo',
'business-cover',
'menu-logo',
'menu-cover',
'church-logo',
'church-cover',
'book-cover',
'vcard-avatar',
'app-icon',
'file',
];
public function handle(Request $request, Closure $next): Response
{
if (! preg_match('#^q/[a-z0-9]#i', ltrim($request->path(), '/'))) {
@@ -19,6 +36,32 @@ class RedirectLegacyQrToLadillLink
return $next($request);
}
if ($this->servesStoredAsset($request)) {
return $next($request);
}
return LadillLink::legacyRedirect($request);
}
private function servesStoredAsset(Request $request): bool
{
$shortCode = $request->route('shortCode');
if (! is_string($shortCode) || $shortCode === '') {
return false;
}
$path = ltrim($request->path(), '/');
$prefix = 'q/'.$shortCode.'/';
if (! str_starts_with($path, $prefix)) {
return false;
}
$suffix = substr($path, strlen($prefix));
if (in_array($suffix, self::STORAGE_ASSET_SUFFIXES, true)) {
return true;
}
return (bool) preg_match('#^(image/\d+|item-image/\d+/\d+)$#', $suffix);
}
}