brightspace-mcp-server 5.1.24 → 5.1.25

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.
@@ -25,10 +25,16 @@ export function decodeEntities(value) {
25
25
  /**
26
26
  * The attributes of every `<tag>` element in `html`, names lowercased and
27
27
  * values entity-decoded. A value ends only at its own closing quote, so an
28
- * apostrophe inside a double-quoted href stays part of it.
28
+ * apostrophe inside a double-quoted href stays part of it, and the element
29
+ * ends at the first `>` outside a quoted value: `title="Week 1 > Notes"` keeps
30
+ * the attributes after it (issue #376). A tag with an unbalanced or stray
31
+ * quote ends at its first `>`, as it always has.
29
32
  */
30
33
  export function tagAttributes(html, tag) {
31
- return [...html.matchAll(new RegExp(`<${tag}\\b[^>]*>`, "gi"))].map(element => new Map([...element[0].matchAll(/([\w-]+)\s*=\s*(["'])([\s\S]*?)\2/g)].map(match => [
34
+ // A quote opens a value only right after `=`; any other quote, or one never
35
+ // closed, fails the first form and leaves the second.
36
+ const pattern = `<${tag}\\b(?:=\\s*(?:"[^"]*"|'[^']*')|[^>"'])*>|<${tag}\\b[^>]*>`;
37
+ return [...html.matchAll(new RegExp(pattern, "gi"))].map(element => new Map([...element[0].matchAll(/([\w-]+)\s*=\s*(["'])([\s\S]*?)\2/g)].map(match => [
32
38
  match[1].toLowerCase(),
33
39
  decodeEntities(match[3]),
34
40
  ])));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "5.1.24",
3
+ "version": "5.1.25",
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",