aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/purl.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-06-29 00:33:13 +0200
committerGitHub <noreply@github.com>2023-06-29 00:33:13 +0200
commitb68d3be4b664671002221d43c82e74a0f1006b26 (patch)
treee60a09d6c5cbd0adb4e393d9b18e4dc4596105e1 /lua/mason-core/purl.lua
parentfix(linker): ensure exec wrapper target is executable (#1380) (diff)
downloadmason-b68d3be4b664671002221d43c82e74a0f1006b26.tar
mason-b68d3be4b664671002221d43c82e74a0f1006b26.tar.gz
mason-b68d3be4b664671002221d43c82e74a0f1006b26.tar.bz2
mason-b68d3be4b664671002221d43c82e74a0f1006b26.tar.lz
mason-b68d3be4b664671002221d43c82e74a0f1006b26.tar.xz
mason-b68d3be4b664671002221d43c82e74a0f1006b26.tar.zst
mason-b68d3be4b664671002221d43c82e74a0f1006b26.zip
fix(purl): percent-encoding is case insensitive (#1382)
Diffstat (limited to 'lua/mason-core/purl.lua')
-rw-r--r--lua/mason-core/purl.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/lua/mason-core/purl.lua b/lua/mason-core/purl.lua
index 6bda134f..65acbdd1 100644
--- a/lua/mason-core/purl.lua
+++ b/lua/mason-core/purl.lua
@@ -16,7 +16,7 @@ local function percent_encode(char)
return ("%%%x"):format(string.byte(char, 1, 1))
end
-local decode_percent_encoding = _.gsub("%%([A-F0-9][A-F0-9])", _.compose(string.char, parse_hex))
+local decode_percent_encoding = _.gsub("%%([A-Fa-f0-9][A-Fa-f0-9])", _.compose(string.char, parse_hex))
local encode_percent_encoding = _.gsub("[!#$&'%(%)%*%+;=%?@%[%] ]", percent_encode)
local function validate_conan(purl)
@@ -162,6 +162,11 @@ local github = _.evolve {
namespace = _.to_lower,
}
+local composer = _.evolve {
+ name = _.to_lower,
+ namespace = _.to_lower,
+}
+
local is_mlflow_azuredatabricks = _.all_pass {
_.prop_eq("type", "mlflow"),
_.path_satisfies(_.matches "^https?://.*azuredatabricks%.net", { "qualifiers", "repository_url" }),
@@ -176,6 +181,7 @@ local type_validations = _.cond {
local type_transforms = _.cond {
{ _.prop_eq("type", "bitbucket"), bitbucket },
+ { _.prop_eq("type", "composer"), composer },
{ _.prop_eq("type", "github"), github },
{ _.prop_eq("type", "pypi"), pypi },
{ _.prop_eq("type", "huggingface"), huggingface },