From 97c276f62d779a411f39740d6bb85d1a9f1b7abb Mon Sep 17 00:00:00 2001 From: nscuro Date: Thu, 13 Aug 2026 18:38:08 +0200 Subject: [PATCH] fix: don't percent-encode colon chars As per https://github.com/package-url/purl-spec/blob/65eeef85de5637ffed26695ffd753202b6a4d656/docs/specification/standard/specification.md#character-encoding: ``` The following characters shall not be percent-encoded: ... * the colon ':', whether used as a Separator Character or otherwise ``` Signed-off-by: nscuro --- src/main/java/com/github/packageurl/internal/StringUtil.java | 1 + src/test/resources/test-suite-data.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/packageurl/internal/StringUtil.java b/src/main/java/com/github/packageurl/internal/StringUtil.java index 5225ce1d..687e5dc2 100644 --- a/src/main/java/com/github/packageurl/internal/StringUtil.java +++ b/src/main/java/com/github/packageurl/internal/StringUtil.java @@ -52,6 +52,7 @@ public final class StringUtil { UNRESERVED_CHARS['.'] = true; UNRESERVED_CHARS['_'] = true; UNRESERVED_CHARS['~'] = true; + UNRESERVED_CHARS[':'] = true; } private StringUtil() { diff --git a/src/test/resources/test-suite-data.json b/src/test/resources/test-suite-data.json index 2eb9b3b9..b9b389dc 100644 --- a/src/test/resources/test-suite-data.json +++ b/src/test/resources/test-suite-data.json @@ -86,7 +86,7 @@ { "description": "docker uses qualifiers and hash image id as versions", "purl": "pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", - "canonical_purl": "pkg:docker/customer/dockerimage@sha256%3A244fd47e07d1004f0aed9c?repository_url=gcr.io", + "canonical_purl": "pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", "type": "docker", "namespace": "customer", "name": "dockerimage",