diff --git a/lib/handlers/route-api.ts b/lib/handlers/route-api.ts index 243cb0698..e07bb187d 100644 --- a/lib/handlers/route-api.ts +++ b/lib/handlers/route-api.ts @@ -225,16 +225,12 @@ export class RouteAPI { }); } - escapeLine(req: express.Request, line: string) { - return line.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>'); - } - filterCode(req: express.Request, code: string, lang: Language) { let lines = code.split('\n'); if (lang.previewFilter !== null) { lines = lines.filter(line => !lang.previewFilter || !lang.previewFilter.test(line)); } - return lines.map(line => this.escapeLine(req, line)).join('\n'); + return lines.join('\n'); } getMetaDataFromLink(req: express.Request, link: ExpandedShortLink | null, config: any) { diff --git a/test/unfurl-tests.ts b/test/unfurl-tests.ts index bfcd02d4f..f91f90979 100644 --- a/test/unfurl-tests.ts +++ b/test/unfurl-tests.ts @@ -106,7 +106,7 @@ describe('Basic unfurls', () => { const res = await prom; expect(res.metadata).toEqual({ ogDescription: - '\ntemplate<typename T>\nconcept TheSameAndAddable = requires(T a, T b) {\n {a+b} -> T;\n};\n\ntemplate<TheSameAndAddable T>\nT sum(T x, T y) {\n return x + y;\n}\n\n#include <string>\n\nint main() {\n int z = 0;\n int w;\n\n return sum(z, w);\n}\n', + '\ntemplate\nconcept TheSameAndAddable = requires(T a, T b) {\n {a+b} -> T;\n};\n\ntemplate\nT sum(T x, T y) {\n return x + y;\n}\n\n#include \n\nint main() {\n int z = 0;\n int w;\n\n return sum(z, w);\n}\n', ogTitle: 'Compiler Explorer - C++', }); });