Skip to content

Commit 1dc76e6

Browse files
authored
Merge pull request #2977 from appwrite/feat/optimize-assets-avif
Fix for data structures.
2 parents fb6fd67 + 22a143a commit 1dc76e6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/lib/utils/metadata.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ export function buildOpenGraphImage(title: string, description: string): string
1515

1616
/**
1717
* Returns an inlined JSON-LD script tag without breaking IDE formatting.
18+
*
19+
* Escapes `<` as `\u003c` so content like `</script>` inside string values
20+
* (e.g. code samples in forum posts) cannot prematurely close the script element
21+
* in HTML; JSON.parse still yields the original `<`.
1822
*/
1923
export function getInlinedScriptTag(jsonSchema: string): string {
20-
return `<script type="application/ld+json">${jsonSchema}</` + 'script>';
24+
const safeForInlineScript = jsonSchema.replace(/</g, '\\u003c');
25+
return `<script type="application/ld+json">${safeForInlineScript}</` + 'script>';
2126
}
2227

2328
/**

0 commit comments

Comments
 (0)