From 4a8fb2eff7e54ca3432fccc405f9974b5b589171 Mon Sep 17 00:00:00 2001 From: Andrei Rybak Date: Tue, 3 Dec 2024 16:13:21 +0100 Subject: [PATCH] bitbucket-copy-commit-reference: BitbucketServer: escape HTML in convertPlainSubjectToHtml A bug in the copy-commit-reference-lib.js caused incorrect HTML to be generated when Jira issues or pull requests are linked in the commit message. Migrate to the new version of the library with the fix. Update HTML handling in the method convertPlainSubjectToHtml of class BitbucketServer according to the new documentation of the class GitHosting in the library code. --- bitbucket-copy-commit-reference.user.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bitbucket-copy-commit-reference.user.js b/bitbucket-copy-commit-reference.user.js index 0f60188..14a4e5a 100644 --- a/bitbucket-copy-commit-reference.user.js +++ b/bitbucket-copy-commit-reference.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Bitbucket: copy commit reference // @namespace https://github.com/rybak/atlassian-tweaks -// @version 13 +// @version 14 // @description Adds a "Copy commit reference" link to every commit page on Bitbucket Cloud and Bitbucket Server. // @license AGPL-3.0-only // @author Andrei Rybak @@ -11,7 +11,7 @@ // @match https://bitbucket.org/*/commits/* // @icon https://bitbucket.org/favicon.ico // @require https://cdn.jsdelivr.net/gh/rybak/userscript-libs@e86c722f2c9cc2a96298c8511028f15c45180185/waitForElement.js -// @require https://cdn.jsdelivr.net/gh/rybak/copy-commit-reference-userscript@1306877cef88bb8792c0851e31454d9b7a82b262/copy-commit-reference-lib.js +// @require https://cdn.jsdelivr.net/gh/rybak/copy-commit-reference-userscript@4f71749bc0d302d4ff4a414b0f4a6eddcc6a56ad/copy-commit-reference-lib.js // @grant none // ==/UserScript== @@ -389,7 +389,8 @@ } async convertPlainSubjectToHtml(plainTextSubject, commitHash) { - return await this.#insertPrLinks(await this.#insertJiraLinks(plainTextSubject), commitHash); + const escapedHtml = super.convertPlainSubjectToHtml(plainTextSubject); + return await this.#insertPrLinks(await this.#insertJiraLinks(escapedHtml), commitHash); } /*