Copilot commented on code in PR #256:
URL:
https://github.com/apache/maven-artifact-plugin/pull/256#discussion_r4111531411
##########
src/main/java/org/apache/maven/plugins/artifact/buildinfo/ReproducibleCentralReport.java:
##########
@@ -172,19 +175,33 @@ private void renderReproducibleCentralArtifact(Sink sink,
Artifact a) {
private void renderReproducibleCentralArtifact(
Sink sink, String groupId, String artifactId, String version,
String scope) {
- String url =
"https://jvm-repo-rebuild.github.io/reproducible-central/badge/artifact/"
- + groupId.replace('.', '/') + '/' + artifactId + ".html";
- String badge = "https://img.shields.io/reproducible-central/artifact/"
+ groupId + '/' + artifactId + '/'
- + version + "?labelColor=1e5b96";
- sink.link(url);
- sink.figureGraphics(badge);
+ sink.link(reproducibleCentralArtifactUrl(groupId, artifactId));
+ sink.figureGraphics(reproducibleCentralArtifactBadgeUrl(groupId,
artifactId, version));
sink.link_();
sink.text(' ' + groupId + ':' + artifactId + ':' + version);
if (scope != null) {
sink.text(" (" + scope + ")");
}
}
+ static String reproducibleCentralArtifactUrl(String groupId, String
artifactId) {
+ return
"https://jvm-repo-rebuild.github.io/reproducible-central/badge/artifact/"
+ + encode(groupId).replace('.', '/') + '/' + encode(artifactId)
+ ".html";
+ }
+
+ static String reproducibleCentralArtifactBadgeUrl(String groupId, String
artifactId, String version) {
+ return "https://img.shields.io/reproducible-central/artifact/" +
encode(groupId) + '/' + encode(artifactId)
+ + '/' + encode(version) + "?labelColor=1e5b96";
+ }
+
+ private static String encode(String s) {
+ try {
+ return URLEncoder.encode(s, StandardCharsets.UTF_8.name());
Review Comment:
`URLEncoder.encode` uses form encoding, so a coordinate containing a space
is emitted with `+`. In these URL path segments, `+` is a literal plus rather
than a space, so the generated badge/link points at the wrong coordinate; use
URI-component encoding (or convert the form `+` to `%20`) and cover a space in
the tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]