New issue
Advanced search Search tips

Issue 8728 link

Starred by 1 user

Issue metadata

Status: Submitted
Owner: ----
Closed: Apr 2018
Components:



Sign in to add a comment

Plusses are not escaped in message push option

Reported by atavak...@yext.com, Apr 10 2018

Issue description

*****************************************************************
*****                                                       *****
***** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!  *****
*****                                                       *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, CYANOGENMOD,  *****
***** INTERNAL ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.*****
*****                                                       *****
*****   THOSE ISSUES BELONG IN DIFFERENT ISSUE TRACKERS     *****
*****                                                       *****
*****************************************************************

Affected Version:

What steps will reproduce the problem?
1. Create a new commit
2. git push origin HEAD:refs/for/master%m=this+message+has+spaces
3. Look at patch-set message

What is the expected output?
this message has spaces

What do you see instead?
this+message+has+spaces

Please provide any additional information below.
The documentation (https://gerrit-review.googlesource.com/Documentation/user-upload.html#message) says that both + and _ are converted to spaces in the message option. It looks like _'s are, but +'s are not.
The following patch is probably sufficient to fix this:

diff --git a/java/com/google/gerrit/server/git/receive/ReceiveCommits.java b/java/com/google/gerrit/server/git/receive/ReceiveCommits.java
index 6b541ba1d9..36a9518dab 100644
--- a/java/com/google/gerrit/server/git/receive/ReceiveCommits.java
+++ b/java/com/google/gerrit/server/git/receive/ReceiveCommits.java
@@ -1364,8 +1364,9 @@ class ReceiveCommits {
     void addMessage(String token) {
       // Many characters have special meaning in the context of a git ref.
       //
-      // Clients can use underscores to represent spaces.
+      // Clients can use underscores or plusses to represent spaces.
       message = token.replace("_", " ");
+      message = token.replace("+", " ");
       try {
         // Other characters can be represented using percent-encoding.
         message = URLDecoder.decode(message, UTF_8.name());


 

Comment 1 Deleted

Comment 2 by atavak...@yext.com, Apr 10 2018

This affects version 2.15-rc4, and also exists on master, at least as of 292a9b3b0b
Project Member

Comment 3 by thomasmu...@yahoo.com, Apr 10 2018

Components: Backend

Comment 4 by atavak...@yext.com, Apr 10 2018

It seems like the percent-encoding changes were added in 83010b57ea999eea0295f015992145868193da14, and the latest stable branch in which this commit is merged is stable-2.10.

Can this change please be cherry-picked or otherwise added to the other releases?
Project Member

Comment 5 by thomasmu...@yahoo.com, Apr 10 2018

Status: ChangeUnderReview (was: New)
https://gerrit-review.googlesource.com/c/gerrit/+/171250
Labels: FixedIn-2.15.2
Status: Submitted (was: ChangeUnderReview)
Status: Released (was: Submitted)
Status: Submitted (was: Released)
Accidentally set to released because a search for label:FixedIn-2.15 also includes the ones with FixedIn-2.15.2

Sign in to add a comment