From 367ccce6a08bb163cfde47ebe44fcdf34593f463 Mon Sep 17 00:00:00 2001 From: mgalindo-sc <161385164+mgalindo-sc@users.noreply.github.com> Date: Wed, 10 Jun 2026 10:05:40 -0700 Subject: [PATCH] Do not percent-encode '+' in classpath-jar manifest Class-Path entries Add '+' to the allowed character class so it passes through literally. The java stub template packs over-long classpaths into a classpath jar whose manifest Class-Path entries percent-encode any character outside [-_.~/a-zA-Z0-9]. Bzlmod canonical repository names put '+' into every external-repo classpath entry, so those entries now contain "%2b" sequences. '+' is a valid URI path character and needs no encoding, and the "%2b" breaks consumers that pass classpath URLs through printf-style formatting --- java/bazel/rules/java_stub_template.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/bazel/rules/java_stub_template.txt b/java/bazel/rules/java_stub_template.txt index 115b46e6..8dddd4a3 100644 --- a/java/bazel/rules/java_stub_template.txt +++ b/java/bazel/rules/java_stub_template.txt @@ -315,14 +315,14 @@ function create_classpath_jar() { for path in ${CLASSPATH}; do # Loop through the characters of the path and convert characters that are # not alphanumeric nor -_.~/ to their 2-digit hexadecimal representation - if [[ ! $path =~ ^[-_.~/a-zA-Z0-9]*$ ]]; then + if [[ ! $path =~ ^[-_.~/a-zA-Z0-9+]*$ ]]; then local i c buff local converted_path="" for ((i=0; i<${#path}; i++)); do c=${path:$i:1} case ${c} in - [-_.~/a-zA-Z0-9] ) buff=${c} ;; + [-_.~/a-zA-Z0-9+] ) buff=${c} ;; * ) printf -v buff '%%%02x' "'$c'" esac converted_path+="${buff}"