Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions lib/islandProjectTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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#..."
Expand Down Expand Up @@ -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)
});
}
}

Expand All @@ -58,4 +73,4 @@ export function parseIslandProjectTypes(): IslandProjectType[] {
*/
export function getIslandProjectTypesForClient(): IslandProjectType[] {
return parseIslandProjectTypes();
}
}