INNER CODE UNIT · TypeScript
decodeCanonicalSegment
Hash-Studios/Prism · infra/cloudflare/worker/src/index.ts:581
function decodeCanonicalSegment(value: string): string {
try {
const decoded = decodeURIComponent(value).trim();
return decoded;
} catch {
return '';
}
}
function normalizePreview(
type: LinkType,
canonical: URL,
input: CreateLinkPreviewInput | undefined,
env: Env,
): PreviewSnapshot {
const defaults = buildDefaultPreview(type, canonical, env);
const merged: PreviewSnapshot = {
title: clipText(sanitizeText(input?.title ?? defaults.title), 90),