From 2025f958627b31afa5f672d11cdad0c60b85817b Mon Sep 17 00:00:00 2001 From: Mohamad Mortada Date: Fri, 8 Aug 2025 19:32:56 -0700 Subject: [PATCH] Unescape characters from title --- lib/islandProjectTypes.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/islandProjectTypes.ts b/lib/islandProjectTypes.ts index 65c3e90..5879c37 100644 --- a/lib/islandProjectTypes.ts +++ b/lib/islandProjectTypes.ts @@ -8,6 +8,18 @@ export interface IslandProjectType { description: string; } +/** + * Unescape string to handle escaped characters like \' and \" + */ +function unescapeString(str: string): string { + return str + .replace(/\\'/g, "'") + .replace(/\\"/g, '"') + .replace(/\\\\/g, "\\") + .replace(/\\n/g, "\n") + .replace(/\\t/g, "\t"); +} + /** * Parse the ISLAND_PROJECTS environment variable * Format: "name1#description1#name2#description2#..." @@ -39,7 +51,10 @@ export function parseIslandProjectTypes(): IslandProjectType[] { const description = parts[i + 1]?.trim(); if (name && description) { - projectTypes.push({ name, description }); + projectTypes.push({ + name: unescapeString(name), + description: unescapeString(description) + }); } } @@ -58,4 +73,4 @@ export function parseIslandProjectTypes(): IslandProjectType[] { */ export function getIslandProjectTypesForClient(): IslandProjectType[] { return parseIslandProjectTypes(); -} \ No newline at end of file +}