fix: CI build errors + simplify cache handler and data cache

- Remove `export const dynamic` from 4 routes (incompatible with cacheComponents)
- Static import for redis-handler (Turbopack can't resolve relative dynamic imports)
- Simplify redis-handler: Buffer.concat, NonNullable, single connect promise
- Inline single-use helpers in integration-data-cache
- Non-greedy SVG regex to prevent ReDoS
- Inline getDevelopmentServiceAliases in next.config
- Remove restating comments
This commit is contained in:
Thomas Camlong committed 2026-08-08 00:19:27 +02:00
1 parent 6f563640ac
commit 345a4be4b0
12 files changed
+79 -98

No files matched your search

@@ -5,5 +5,3 @@ import crowdinContributors from "@static-data/translators.json";
export const GET = () => {
return NextResponse.json(crowdinContributors);
};
export const dynamic = "force-static";
@@ -5,5 +5,3 @@ import githubContributors from "@static-data/contributors.json";
export const GET = () => {
return NextResponse.json(githubContributors);
};
export const dynamic = "force-static";
@@ -5,5 +5,3 @@ import openCollectiveContributors from "@static-data/opencollective-contributors
export const GET = () => {
return NextResponse.json(openCollectiveContributors);
};
export const dynamic = "force-static";
@@ -6,5 +6,3 @@ export const GET = async () => {
const dependencies = await getDependenciesAsync();
return NextResponse.json(dependencies);
};
export const dynamic = "force-static";
@@ -87,12 +87,10 @@ export const sanitizeSvg = (svgText: string) => {
// linkedom's DOMParser omits html/body for fragment-only SVG; DOMPurify needs a body root.
const wrapped = `<html><body>${svgText}</body></html>`;
const sanitized = purify.sanitize(wrapped, svgSanitizeOptions);
const svgMatch = sanitized.match(/<svg[^>]*\/>|<svg[\s\S]*<\/svg>/i);
const svgMatch = sanitized.match(/<svg[^>]*\/>|<svg[\s\S]*?<\/svg>/i);
return svgMatch ? svgMatch[0] : "";
};
// ponytail: content-based SVG detection — catches mislabeled MIME types.
// Ceiling: only checks first 512 bytes; deeply embedded SVG in other XML won't match.
export function looksLikeSvg(content: Uint8Array): boolean {
const head = new TextDecoder().decode(content.subarray(0, 512));
return /<svg[\s>]/i.test(head);