Skip to content

Commit 24006a9

Browse files
committed
行の末尾に\rが含まれていた場合bodyLinesの取得に失敗していた
1 parent b871342 commit 24006a9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

rest/__snapshots__/getCodeBlocks.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ snapshot[`getCodeBlocks() 1`] = `
6969
{
7070
created: 1672982822,
7171
id: "63b7b1261280f00000c9bc2d",
72-
text: " - インデント",
72+
text: " - インデント\\r",
7373
updated: 1672982822,
7474
userId: "5ef2bdebb60650001e1280f0",
7575
},
@@ -233,7 +233,7 @@ snapshot[`getCodeBlocks() > filename filter 1`] = `
233233
{
234234
created: 1672982822,
235235
id: "63b7b1261280f00000c9bc2d",
236-
text: " - インデント",
236+
text: " - インデント\\r",
237237
updated: 1672982822,
238238
userId: "5ef2bdebb60650001e1280f0",
239239
},

rest/getCodeBlocks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const sample: Line[] = [
9494
},
9595
{
9696
"id": "63b7b1261280f00000c9bc2d",
97-
"text": " - インデント",
97+
"text": " - インデント\r",
9898
"userId": "5ef2bdebb60650001e1280f0",
9999
"created": 1672982822,
100100
"updated": 1672982822,

rest/getCodeBlocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function extractFromCodeBody(
128128
lineText: string,
129129
titleIndent: number,
130130
): string | null {
131-
const matched = lineText.match(/^(\s*)(.*)$/);
131+
const matched = lineText.replaceAll("\r", "").match(/^(\s*)(.*)$/);
132132
if (matched === null || matched.length < 2) {
133133
return null;
134134
}

0 commit comments

Comments
 (0)