Skip to content

Commit c97c935

Browse files
Merge pull request #153 from SingularityNET-Archive:development
refactor: Update sanitizeObject function to replace en dash and em dash with ASCII hyphen
2 parents 27710fd + 9187622 commit c97c935

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

netlify/functions/batchUpdateMeetingSummariesArray.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const MAX_CONCURRENT_REQUESTS = 10;
77

88
function sanitizeObject(item) {
99
if (typeof item === 'string') {
10-
// Replace anything outside ASCII printable chars (0x20–0x7E) with '-'
11-
return item.replace(/[^a-zA-Z0-9.,:;!?"'()\-\s]/g, '-');
10+
// Only replace en dash (U+2013) or em dash (U+2014) with ASCII hyphen '-'
11+
return item.replace(/[\u2013\u2014]/g, '-');
1212
}
1313

1414
if (Array.isArray(item)) {
@@ -109,8 +109,8 @@ async function processAndCommitSummaries() {
109109
const flattenedSummaries = summariesBatches.flat();
110110

111111
if (flattenedSummaries.length === 0) {
112-
//hasMoreSummaries = false;
113-
//break;
112+
hasMoreSummaries = false;
113+
break;
114114
}
115115

116116
groupSummariesByYear(flattenedSummaries, allSummaries);

netlify/functions/batchUpdateMeetingSummariesById.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const MAX_CONCURRENT_REQUESTS = 10;
77

88
function sanitizeObject(item) {
99
if (typeof item === 'string') {
10-
// Replace anything outside ASCII printable chars (0x20-0x7E) with '-'
11-
return item.replace(/[^a-zA-Z0-9.,:;!?"'()\-\s]/g, '-');
10+
// Only replace en dash (U+2013) or em dash (U+2014) with ASCII hyphen '-'
11+
return item.replace(/[\u2013\u2014]/g, '-');
1212
}
1313

1414
if (Array.isArray(item)) {
@@ -115,8 +115,8 @@ async function processAndCommitSummaries() {
115115
const flattenedSummaries = summariesBatches.flat();
116116

117117
if (flattenedSummaries.length === 0) {
118-
//hasMoreSummaries = false;
119-
//break;
118+
hasMoreSummaries = false;
119+
break;
120120
}
121121

122122
flattenedSummaries.forEach(summary => {

0 commit comments

Comments
 (0)