Skip to content

Comment.getShortSummary does not work for Windows line ending \r\n #3093

@Pistonight

Description

@Pistonight

Search terms

Comment, getShortSummary, windows, line ending, CRLF

Expected Behavior

For a comment object like

"comment": {
	"summary": [
		{
			"kind": "text",
			"text": "First\r\n\r\nSecond"
		}
	]
},

getShortSummary should return "First"

Actual Behavior

It returns First\r\n\r\nSecond

Steps to reproduce the bug

    it("Handles a multi-paragraph comment with Windows line ending", () => {
        const comment = new Comment([
            {
                kind: "text",
                text: "Paragraph one\r\n\r\nParagraph two",
            },
        ]);

        equal(comment.getShortSummary(true), [
            { kind: "text", text: "Paragraph one" },
        ]);
    });

Other

Looks like the cause might be pretty straightforward as the code only checks for \n\n

return part.text.includes("\n\n");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions