Skip to content

Commit

Permalink
fix: handle eol inside strings, too
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Dec 6, 2022
1 parent 6b0eccb commit 0f101b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/commands/dev/convert/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export default class DevConvertMessages extends SfCommand<DevConvertMessagesResu

const convertValue = (key: string, value: string | string[] | Record<string, string>): string => {
if (typeof value === 'string') {
return `# ${key}${skip1Line}${value.trim()}`;
// trim, and also convert any internal new line characters to os EOL
return `# ${key}${skip1Line}${value.trim().replace(/(\\r\\n|\\r|\\n)/g, EOL)}`;
} else if (Array.isArray(value)) {
return [`# ${key}`, `${skip1Line}- ` + value.join(`${skip1Line}- `)].join('');
} else {
Expand Down

0 comments on commit 0f101b5

Please sign in to comment.