From 5aa272da7924fa76581fd5ea83b24cfbb3528b8a Mon Sep 17 00:00:00 2001 From: jNullj <15849761+jNullj@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:38:31 +0300 Subject: [PATCH] addv ignore commit hash some services might return version as a commit hash like aur. it makes no sense to prefix v before the commit. Fixes #10591 --- services/text-formatters.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/text-formatters.js b/services/text-formatters.js index a1eb1710053e9..185170e023148 100644 --- a/services/text-formatters.js +++ b/services/text-formatters.js @@ -127,11 +127,12 @@ function omitv(version) { return version } -const ignoredVersionPatterns = /^[^0-9]|[0-9]{4}-[0-9]{2}-[0-9]{2}/ +const ignoredVersionPatterns = + /^[^0-9]|[0-9]{4}-[0-9]{2}-[0-9]{2}|^[a-f0-9]{7,40}$/ /** - * Add a starting v to the version unless it doesn't starts with a digit or is a date (yyyy-mm-dd) - * For example, addv("1.2.3") returns "v1.2.3", but addv("hello") or addv("2021-10-31"), returns "hello" and "2021-10-31" respectively. + * Add a starting v to the version unless it doesn't starts with a digit, is a date (yyyy-mm-dd), or is a commit hash. + * For example, addv("1.2.3") returns "v1.2.3", but addv("hello"), addv("2021-10-31"), addv("abcdef1"), returns "hello", "2021-10-31", and "abcdef1" respectively. * * @param {string} version - Version string * @returns {string} Version string with the starting v