Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8391a98

Browse files
committed
normalize line endings
1 parentcf8c944 commit8391a98

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎coderd/notifications/notifications_test.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,13 @@ func TestNotificationTemplates_Golden(t *testing.T) {
13351335
}
13361336
}
13371337

1338+
// normalizeLineEndings ensures that all line endings are normalized to \n.
1339+
// Required for Windows compatibility.
1340+
funcnormalizeLineEndings(content []byte) []byte {
1341+
content=bytes.ReplaceAll(content, []byte("\r\n"), []byte("\n"))
1342+
returnbytes.ReplaceAll(content, []byte("\r"), []byte("\n"))
1343+
}
1344+
13381345
funcnormalizeGoldenEmail(content []byte) []byte {
13391346
const (
13401347
constantDate="Fri, 11 Oct 2024 09:03:06 +0000"
@@ -1355,6 +1362,7 @@ func normalizeGoldenEmail(content []byte) []byte {
13551362
content=dateRegex.ReplaceAll(content, []byte("Date: "+constantDate))
13561363
content=messageIDRegex.ReplaceAll(content, []byte("Message-Id: "+constantMessageID))
13571364
content=bytes.ReplaceAll(content,boundary, []byte(constantBoundary))
1365+
content=normalizeLineEndings(content)
13581366

13591367
returncontent
13601368
}
@@ -1363,6 +1371,7 @@ func normalizeGoldenWebhook(content []byte) []byte {
13631371
constconstantUUID="00000000-0000-0000-0000-000000000000"
13641372
uuidRegex:=regexp.MustCompile(`[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}`)
13651373
content=uuidRegex.ReplaceAll(content, []byte(constantUUID))
1374+
content=normalizeLineEndings(content)
13661375

13671376
returncontent
13681377
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp