From 2b0155c24da8f1b74d9a44935f1cef4975be3697 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Sun, 19 Jul 2026 22:45:49 +0530 Subject: [PATCH 1/2] fix: 3 bare excepts should catch ValueError instead of BaseException --- scripts/extract_rankings.py | 2 +- scripts/extract_rankings_v2.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/extract_rankings.py b/scripts/extract_rankings.py index 19bdf332..36bdb88c 100644 --- a/scripts/extract_rankings.py +++ b/scripts/extract_rankings.py @@ -64,7 +64,7 @@ def extract_rankings(): # Check if Rank is numeric, if not skip (it might be a comment row) try: rank = int(rank_val) - except: + except ValueError: continue item = { diff --git a/scripts/extract_rankings_v2.py b/scripts/extract_rankings_v2.py index 295a060d..a3cae61a 100644 --- a/scripts/extract_rankings_v2.py +++ b/scripts/extract_rankings_v2.py @@ -18,7 +18,7 @@ def safe_float(val): if match: try: return float(match.group(1)) - except: + except ValueError: pass return 0.0 @@ -96,7 +96,7 @@ def extract_rankings(): try: rank = int(rank_val) - except: + except ValueError: continue if i == 0: From 67d49dee0fd427eed591af44c178addc5e39e889 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 23 Jul 2026 17:16:19 +0530 Subject: [PATCH 2/2] fix: replace innerHTML with textContent and fix NotificationDropdown spread order - wiki/page.tsx: use textContent instead of innerHTML for the copy button to avoid XSS vectors, hydration mismatches, and DOM manipulation anti-patterns in React - NotificationDropdown.tsx: place id after the spread so doc.data() fields cannot override the Firestore document id --- src/app/wiki/page.tsx | 6 +++--- src/components/NotificationDropdown.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/wiki/page.tsx b/src/app/wiki/page.tsx index e8a338eb..89e9b410 100644 --- a/src/app/wiki/page.tsx +++ b/src/app/wiki/page.tsx @@ -69,17 +69,17 @@ export default function WikiPage() { const button = document.createElement('button'); button.className = 'absolute right-3 top-3 px-2 py-1 text-xs font-semibold bg-zinc-900/80 text-zinc-300 rounded border border-white/10 opacity-0 group-hover:opacity-100 hover:bg-zinc-800 hover:text-white transition-all duration-200 shadow-md cursor-pointer backdrop-blur-sm'; - button.innerHTML = 'Copy'; + button.textContent = 'Copy'; button.type = 'button'; button.addEventListener('click', async () => { const codeText = pre.textContent || ''; try { await navigator.clipboard.writeText(codeText); - button.innerHTML = 'Copied!'; + button.textContent = 'Copied!'; button.className = 'absolute right-3 top-3 px-2 py-1 text-xs font-semibold bg-emerald-600 text-white rounded border border-emerald-500 transition-all duration-200 shadow-md'; setTimeout(() => { - button.innerHTML = 'Copy'; + button.textContent = 'Copy'; button.className = 'absolute right-3 top-3 px-2 py-1 text-xs font-semibold bg-zinc-900/80 text-zinc-300 rounded border border-white/10 opacity-0 group-hover:opacity-100 hover:bg-zinc-800 hover:text-white transition-all duration-200 shadow-md cursor-pointer backdrop-blur-sm'; }, 2000); } catch (err) { diff --git a/src/components/NotificationDropdown.tsx b/src/components/NotificationDropdown.tsx index c6c5c017..8748d675 100644 --- a/src/components/NotificationDropdown.tsx +++ b/src/components/NotificationDropdown.tsx @@ -50,7 +50,7 @@ export function NotificationDropdown() { const unsubscribe = onSnapshot(q, (snapshot) => { - setNotifications(snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() } as Notification))); + setNotifications(snapshot.docs.map(doc => ({ ...doc.data(), id: doc.id } as Notification))); }, (error) => { console.error("Notification subscription error:", error);