@chat-adapter/teams 4.17.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3890,8 +3890,22 @@ var TeamsFormatConverter = class extends BaseFormatConverter {
3890
3890
  );
3891
3891
  markdown = markdown.replace(/<code>([^<]+)<\/code>/gi, "`$1`");
3892
3892
  markdown = markdown.replace(/<pre>([^<]+)<\/pre>/gi, "```\n$1\n```");
3893
- markdown = markdown.replace(/<[^>]+>/g, "");
3894
- markdown = markdown.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
3893
+ let prev;
3894
+ do {
3895
+ prev = markdown;
3896
+ markdown = markdown.replace(/<[^>]+>/g, "");
3897
+ } while (markdown !== prev);
3898
+ const entityMap = {
3899
+ "&lt;": "<",
3900
+ "&gt;": ">",
3901
+ "&amp;": "&",
3902
+ "&quot;": '"',
3903
+ "&#39;": "'"
3904
+ };
3905
+ markdown = markdown.replace(
3906
+ /&(?:lt|gt|amp|quot|#39);/g,
3907
+ (match) => entityMap[match] ?? match
3908
+ );
3895
3909
  return parseMarkdown(markdown);
3896
3910
  }
3897
3911
  nodeToTeams(node) {
@@ -5087,7 +5101,13 @@ var TeamsAdapter = class {
5087
5101
  }
5088
5102
  let text = "";
5089
5103
  if (msg.body?.content) {
5090
- text = msg.body.content.replace(/<[^>]*>/g, "").trim();
5104
+ let stripped = msg.body.content;
5105
+ let prev;
5106
+ do {
5107
+ prev = stripped;
5108
+ stripped = stripped.replace(/<[^>]*>/g, "");
5109
+ } while (stripped !== prev);
5110
+ text = stripped.trim();
5091
5111
  }
5092
5112
  if (!text && msg.attachments?.length) {
5093
5113
  for (const att of msg.attachments) {