brightspace-mcp-server 5.1.16 → 5.1.17

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.
@@ -7,15 +7,20 @@
7
7
  function codePoint(whole, code) {
8
8
  return code <= 0x10ffff ? String.fromCodePoint(code) : whole;
9
9
  }
10
- /** Decode the character references Brightspace's HTML editor writes into attribute values. */
10
+ const NAMED = { quot: '"', lt: "<", gt: ">", amp: "&" };
11
+ /**
12
+ * Decode the character references Brightspace's HTML editor writes into
13
+ * attribute values, in one pass so a decoded `&` never starts another
14
+ * reference: `&#38;lt;` is the text `&lt;`, not `<` (issue #360).
15
+ */
11
16
  export function decodeEntities(value) {
12
- return value
13
- .replace(/&#x([0-9a-f]+);/gi, (whole, hex) => codePoint(whole, parseInt(hex, 16)))
14
- .replace(/&#(\d+);/g, (whole, dec) => codePoint(whole, parseInt(dec, 10)))
15
- .replace(/&quot;/g, '"')
16
- .replace(/&lt;/g, "<")
17
- .replace(/&gt;/g, ">")
18
- .replace(/&amp;/g, "&");
17
+ return value.replace(/&(?:#[xX]([0-9a-fA-F]+)|#(\d+)|(quot|lt|gt|amp));/g, (whole, hex, dec, name) => {
18
+ if (hex !== undefined)
19
+ return codePoint(whole, parseInt(hex, 16));
20
+ if (dec !== undefined)
21
+ return codePoint(whole, parseInt(dec, 10));
22
+ return NAMED[name];
23
+ });
19
24
  }
20
25
  /**
21
26
  * The attributes of every `<tag>` element in `html`, names lowercased and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "5.1.16",
3
+ "version": "5.1.17",
4
4
  "mcpName": "io.github.RohanMuppa/brightspace",
5
5
  "description": "MCP server for Brightspace (D2L). Check grades, due dates, assignments, announcements, syllabus, rosters and more via Claude, ChatGPT, Cursor, Windsurf, or any MCP client.",
6
6
  "type": "module",