diff --git a/frontend/src/api.ts b/frontend/src/api.ts index ae2b1c7..d44e865 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -162,7 +162,7 @@ export async function fetchTalk(id: string): Promise { headers: getSessionHeaders(), }); if (!response.ok) { - throw new Error(`Failed to fetch talk: ${response.statusText}`); + throw new Error(`Failed to fetch talk: ${response.status}`); } return response.json(); } diff --git a/frontend/src/components/ResultsTable.tsx b/frontend/src/components/ResultsTable.tsx index ab4b79f..c589bf8 100644 --- a/frontend/src/components/ResultsTable.tsx +++ b/frontend/src/components/ResultsTable.tsx @@ -74,7 +74,7 @@ export function ResultsTable({ results, exportResults, onLoadMore, nextBatchSize {results.map((hit) => { // Always use _id, and strip "speeches/" prefix for routing - const talkKey = hit._id?.startsWith("speeches/") ? hit._id.slice(6) : hit._id; + const talkKey = hit._id?.startsWith("speeches/") ? hit._id.slice("speeches/".length) : hit._id; if (!talkKey) { console.warn("Result hit missing _id:", hit); } diff --git a/frontend/src/components/TalkView.tsx b/frontend/src/components/TalkView.tsx index 68e3710..2cd0641 100644 --- a/frontend/src/components/TalkView.tsx +++ b/frontend/src/components/TalkView.tsx @@ -77,7 +77,7 @@ export function TalkView() { const idString = typeof rawId === 'object' && rawId !== null && '_id' in rawId ? (rawId as any)._id : String(rawId); - const result = idString.startsWith("speeches/") ? idString.slice(6) : idString; + const result = idString.startsWith("speeches/") ? idString.slice("speeches/".length) : idString; return result; }; const previousId = normalizeTalkId(previousTalk); diff --git a/frontend/src/context/TalkDrawerContext.tsx b/frontend/src/context/TalkDrawerContext.tsx index 428ec20..c2af952 100644 --- a/frontend/src/context/TalkDrawerContext.tsx +++ b/frontend/src/context/TalkDrawerContext.tsx @@ -10,7 +10,7 @@ const TalkDrawerContext = createContext(null); /** Strips the ArangoDB "speeches/" collection prefix so callers can pass either form. */ export function normalizeTalkId(rawId: string): string { - return rawId.startsWith("speeches/") ? rawId.slice(6) : rawId; + return rawId.startsWith("speeches/") ? rawId.slice("speeches/".length) : rawId; } export function TalkDrawerProvider({ children }: { children: ReactNode }) { diff --git a/frontend/src/utils/markdown.ts b/frontend/src/utils/markdown.ts index 2286c3c..01c1209 100644 --- a/frontend/src/utils/markdown.ts +++ b/frontend/src/utils/markdown.ts @@ -28,7 +28,7 @@ export const convertMarkdownToHtml = (markdown: string, sources?: ChatSource[]): if (raw.startsWith("documents/")) { talkPathByIndex.set(i + 1, `/motion/${raw.slice("documents/".length)}`); } else { - const key = raw.startsWith("speeches/") ? raw.slice(6) : raw; + const key = raw.startsWith("speeches/") ? raw.slice("speeches/".length) : raw; if (key) talkPathByIndex.set(i + 1, `/talk/${key}`); } });