Skip to content

Commit df3faa0

Browse files
committed
A few more tweaks for new lines
1 parent b3b34d7 commit df3faa0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

issue-to-json.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ async function parseIssueBody(githubFormData, body) {
2222
// Markdown fields aren’t included in output body
2323
let fields = githubFormData.body.filter(field => field.type !== "markdown");
2424

25-
// Warning: this will likely not handle new lines in a textarea field
25+
// Warning: this will likely not handle new lines in a textarea field input
2626
let bodyData = body.split("\n").filter(entry => {
2727
return !!entry && !entry.startsWith("###")
2828
}).map(entry => {
29-
let entry = removeNewLines(entry);
29+
entry = entry.trim();
30+
3031
return entry === "_No response_" ? "" : entry;
3132
});
3233

@@ -43,13 +44,14 @@ async function parseIssueBody(githubFormData, body) {
4344
let fieldLabel = fields[j] && fields[j].attributes && fields[j].attributes.label;
4445
if(fieldLabel && (fieldLabel.toLowerCase().endsWith("(gitHub usernames)") || fieldLabel.toLowerCase().endsWith("(twitter usernames)"))) {
4546
entry = entry.split(" ").map(name => {
46-
return name.trim().replace(/\,/g, "");
47+
return removeNewLines(name).trim().replace(/\,/g, "");
4748
}).filter(name => !!name).map(name => {
4849
return name.startsWith("@") ? name.substring(1) : name;
4950
});
5051
}
5152

5253
if(fieldLabel && fieldLabel.toLowerCase() === "url" || fields[j].id === "url" || fields[j].id.endsWith("_url") || fields[j].id.startsWith("url_")) {
54+
entry = removeNewLines(entry);
5355
console.log( "About to cleanup URL: ", { entry } );
5456
entry = await cleanupUrl(entry);
5557
}

0 commit comments

Comments
 (0)