diff --git a/packages/lib/server-only/pdf/helpers.ts b/packages/lib/server-only/pdf/helpers.ts index 930920294..36f54a9b5 100644 --- a/packages/lib/server-only/pdf/helpers.ts +++ b/packages/lib/server-only/pdf/helpers.ts @@ -108,6 +108,13 @@ const unescapePlaceholderValue = (value: string): string => { return value.replace(/\\([,=|\\])/g, '$1'); }; +/* + Cleans up a selection option/default after splitting: + unescapes literal delimiters, collapses repeated whitespace, and trims the ends. + + E.g. + ' Legal\, Compliance ' -> 'Legal, Compliance' +*/ const normalizePlaceholderSelectionValue = (value: string): string => { return unescapePlaceholderValue(value).replace(/\s+/g, ' ').trim(); };