Skip to content

Commit 23e8972

Browse files
committed
refactor: Enhance sanitizeObject function to replace curly quotes with ASCII equivalents
1 parent 9187622 commit 23e8972

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

netlify/functions/batchUpdateMeetingSummariesArray.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ const MAX_CONCURRENT_REQUESTS = 10;
88
function sanitizeObject(item) {
99
if (typeof item === 'string') {
1010
// Only replace en dash (U+2013) or em dash (U+2014) with ASCII hyphen '-'
11-
return item.replace(/[\u2013\u2014]/g, '-');
11+
// Replace curly single quotes ’ and ‘ with straight ASCII apostrophe '
12+
// Replace curly double quotes ” and “ with straight ASCII quote "
13+
return item
14+
.replace(/[\u2013\u2014]/g, '-')
15+
.replace(/[\u2018\u2019]/g, "'")
16+
.replace(/[\u201C\u201D]/g, '"')
17+
.trim();
1218
}
1319

1420
if (Array.isArray(item)) {

netlify/functions/batchUpdateMeetingSummariesById.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ const MAX_CONCURRENT_REQUESTS = 10;
88
function sanitizeObject(item) {
99
if (typeof item === 'string') {
1010
// Only replace en dash (U+2013) or em dash (U+2014) with ASCII hyphen '-'
11-
return item.replace(/[\u2013\u2014]/g, '-');
11+
// Replace curly single quotes ’ and ‘ with straight ASCII apostrophe '
12+
// Replace curly double quotes ” and “ with straight ASCII quote "
13+
return item
14+
.replace(/[\u2013\u2014]/g, '-')
15+
.replace(/[\u2018\u2019]/g, "'")
16+
.replace(/[\u201C\u201D]/g, '"')
17+
.trim();
1218
}
1319

1420
if (Array.isArray(item)) {

0 commit comments

Comments
 (0)