From e03f745656174bd7944f43464414936725907066 Mon Sep 17 00:00:00 2001 From: midi Date: Sat, 11 Apr 2026 12:56:15 +0200 Subject: [PATCH 1/2] patch: Fix malformed Telex tip url parsing --- app/src/pages/ballot/telex-mandate-section.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/pages/ballot/telex-mandate-section.tsx b/app/src/pages/ballot/telex-mandate-section.tsx index 681f334..9f1b396 100644 --- a/app/src/pages/ballot/telex-mandate-section.tsx +++ b/app/src/pages/ballot/telex-mandate-section.tsx @@ -11,9 +11,11 @@ function extractTelexId(input: string): string | null { if (UUID_RE.test(trimmed)) return trimmed try { const url = new URL(trimmed) - if (url.hostname === 'telex.hu' && url.pathname.startsWith('/melleklet/valasztas-2026/tippjatek/')) { - const id = url.pathname.replace('/melleklet/valasztas-2026/tippjatek/', '').replace(/\/$/, '') - if (UUID_RE.test(id)) return id + if (url.hostname === 'telex.hu' && url.pathname.includes('/tippjatek/')) { + // Match the UUID anywhere in the path — handles both the normal form + // (.../tippjatek/) and the Telex copy-link bug (.../tippjatek//) + const match = url.pathname.match(UUID_RE) + if (match) return match[0] } } catch { // not a valid URL — fall through From 0b43411b5c09fc979fab7fad16212a3c422e2567 Mon Sep 17 00:00:00 2001 From: midi Date: Sat, 11 Apr 2026 13:33:56 +0200 Subject: [PATCH 2/2] patch: Fix malformed Telex tip url parsing 2 --- app/src/pages/ballot/telex-mandate-section.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/pages/ballot/telex-mandate-section.tsx b/app/src/pages/ballot/telex-mandate-section.tsx index 9f1b396..93f2dcb 100644 --- a/app/src/pages/ballot/telex-mandate-section.tsx +++ b/app/src/pages/ballot/telex-mandate-section.tsx @@ -4,7 +4,10 @@ import { Check, ExternalLink, Link2, X } from 'lucide-react' import type { VotingDraft } from '@/hooks/use-prediction' const TELEX_BASE = 'https://telex.hu/melleklet/valasztas-2026/tippjatek/' +// Full-string test (with anchors) — used to validate a bare UUID input const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i +// Substring search (no anchors) — used to find a UUID anywhere inside a URL path +const UUID_IN_PATH = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i function extractTelexId(input: string): string | null { const trimmed = input.trim() @@ -12,9 +15,10 @@ function extractTelexId(input: string): string | null { try { const url = new URL(trimmed) if (url.hostname === 'telex.hu' && url.pathname.includes('/tippjatek/')) { - // Match the UUID anywhere in the path — handles both the normal form - // (.../tippjatek/) and the Telex copy-link bug (.../tippjatek//) - const match = url.pathname.match(UUID_RE) + // UUID_IN_PATH has no anchors so it finds the UUID anywhere in the path, + // handling both the normal form (.../tippjatek/) and the Telex + // copy-link bug (.../tippjatek//) + const match = url.pathname.match(UUID_IN_PATH) if (match) return match[0] } } catch {