FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Do not percent-encode '+' in classpath-jar manifest Class-Path entrie… · bazelbuild/rules_java@35e8391 · GitHub

Repository navigation

Commit 35e8391

Browse files
authored andcommitted
Do not percent-encode '+' in classpath-jar manifest Class-Path entries (#358)
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 Closes #358 COPYBARA_INTEGRATE_REVIEW=#358 from mgalindo-sc:patch-1 367ccce PiperOrigin-RevId: 931225696 Change-Id: I3c4e215afc4c67e25e48485cd58d0c2fe2dcd74c
1 parent 1f215f8 commit 35e8391

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎java/bazel/rules/java_stub_template.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,14 @@ function create_classpath_jar() {
315315
for path in ${CLASSPATH}; do
316316
# Loop through the characters of the path and convert characters that are
317317
# not alphanumeric nor -_.~/ to their 2-digit hexadecimal representation
318-
if [[ ! $path =~ ^[-_.~/a-zA-Z0-9]*$ ]]; then
318+
if [[ ! $path =~ ^[-_.~/a-zA-Z0-9+]*$ ]]; then
319319
local i c buff
320320
local converted_path=""
321321

322322
for ((i=0; i<${#path}; i++)); do
323323
c=${path:$i:1}
324324
case ${c} in
325-
[-_.~/a-zA-Z0-9] ) buff=${c} ;;
325+
[-_.~/a-zA-Z0-9+] ) buff=${c} ;;
326326
* ) printf -v buff '%%%02x' "'$c'"
327327
esac
328328
converted_path+="${buff}"

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL