Skip to content

Commit

Permalink
Merge pull request #70 from ringcentral/fixRegex
Browse files Browse the repository at this point in the history
Fix regex
  • Loading branch information
embbnux authored Dec 31, 2024
2 parents e17ef67 + da56796 commit 7263030
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/adapters/netsuite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ function upsertCallAgentNote({ body, note }) {
}
const noteRegex = /^- Note:[^\n]*(?:\n(?!- ).*)*/m;
if (noteRegex.test(body)) {
body = body.replace(noteRegex, `- Note: ${note}\n`);
body = body.replace(noteRegex, `- Note: ${note}`);
}
else {
if (body && !body.endsWith('\n')) {
Expand All @@ -812,7 +812,7 @@ function upsertCallResult({ body, result }) {
function upsertCallDuration({ body, duration }) {
const durationRegex = /- Duration: (.+?)(?=\n|$)/g;
if (durationRegex.test(body)) {
body = body.replace(durationRegex, `- Duration: ${secondsToHoursMinutesSeconds(duration)}\n`);
body = body.replace(durationRegex, `- Duration: ${secondsToHoursMinutesSeconds(duration)}`);
} else {
body += `- Duration: ${secondsToHoursMinutesSeconds(duration)}\n`;
}
Expand All @@ -830,9 +830,9 @@ function upsertContactPhoneNumber({ body, phoneNumber, direction }) {
}

function upsertCallRecording({ body, recordingLink }) {
const recordingLinkRegex = RegExp('- Call recording link: (.+?)\n');
const recordingLinkRegex = /- Call recording link: (.+?)(?=\n|$)/g;
if (!!recordingLink && recordingLinkRegex.test(body)) {
body = body.replace(recordingLinkRegex, `- Call recording link: ${recordingLink}\n`);
body = body.replace(recordingLinkRegex, `- Call recording link: ${recordingLink}`);
} else if (!!recordingLink) {
// if not end with new line, add new line
if (body && !body.endsWith('\n')) {
Expand Down

0 comments on commit 7263030

Please sign in to comment.