@@ -1335,6 +1335,13 @@ func TestNotificationTemplates_Golden(t *testing.T) {
1335
1335
}
1336
1336
}
1337
1337
1338
+ // normalizeLineEndings ensures that all line endings are normalized to \n.
1339
+ // Required for Windows compatibility.
1340
+ func normalizeLineEndings (content []byte ) []byte {
1341
+ content = bytes .ReplaceAll (content , []byte ("\r \n " ), []byte ("\n " ))
1342
+ return bytes .ReplaceAll (content , []byte ("\r " ), []byte ("\n " ))
1343
+ }
1344
+
1338
1345
func normalizeGoldenEmail (content []byte ) []byte {
1339
1346
const (
1340
1347
constantDate = "Fri, 11 Oct 2024 09:03:06 +0000"
@@ -1355,6 +1362,7 @@ func normalizeGoldenEmail(content []byte) []byte {
1355
1362
content = dateRegex .ReplaceAll (content , []byte ("Date: " + constantDate ))
1356
1363
content = messageIDRegex .ReplaceAll (content , []byte ("Message-Id: " + constantMessageID ))
1357
1364
content = bytes .ReplaceAll (content , boundary , []byte (constantBoundary ))
1365
+ content = normalizeLineEndings (content )
1358
1366
1359
1367
return content
1360
1368
}
@@ -1363,6 +1371,7 @@ func normalizeGoldenWebhook(content []byte) []byte {
1363
1371
const constantUUID = "00000000-0000-0000-0000-000000000000"
1364
1372
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}` )
1365
1373
content = uuidRegex .ReplaceAll (content , []byte (constantUUID ))
1374
+ content = normalizeLineEndings (content )
1366
1375
1367
1376
return content
1368
1377
}
0 commit comments