Skip to content

Commit

Permalink
dashboard: create suggested ignores based on the original URL charact…
Browse files Browse the repository at this point in the history
…ers, not the escaped URL in the DOM

Fixes #340
  • Loading branch information
ivan committed Jun 9, 2023
1 parent 7f94238 commit 7077606
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dashboard/assets/scripts/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,13 @@ class JobsRenderer {
} else {
attrs = Reusable.obj_className_line_normal;
}
const url = data.url;
// For testing a URL with characters that browsers like to escape, breaking the suggested ignores
// url = "http://example.com/m/index.php/{$ibforums-%3Evars[TEAM_ICON_URL]}/t82380.html^hi";
logSegment.appendChild(
h("div", attrs, [
`${data.response_code} ${data.wget_code} `,
h("a", { href: data.url, className: "log-url" }, data.url),
h("a", { href: url, className: "log-url" }, url),
]),
);
return 1;
Expand Down Expand Up @@ -842,7 +845,11 @@ class ContextMenuRenderer {
this.element.style.top = `${ev.clientY}px`;

const ident = ev.target.parentNode.parentNode.parentNode.id.match(/^log-window-(.*)/)[1];
const url = ev.target.href;
// Get the URL from the .textContent instead of the .href because
// browsers URL-encode characters like { } ^ as they are added to
// the DOM, while we want the original, unescaped characters to create
// the correct ignore pattern.
const url = ev.target.textContent;
const maxSuggestedIgnores = 8;
this.resetEntries(ident, url, maxSuggestedIgnores);

Expand Down

0 comments on commit 7077606

Please sign in to comment.