diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-05-04 06:58:56 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-05-04 06:58:56 +0000 |
commit | e9e79fdfdf7eee14efa9c5e8038b46538b6ac5e3 (patch) | |
tree | e5ab960df95e22c3f9e562ccb1227f48966902e8 /app | |
parent | 3466ee7cef406db75b8f5f4d1f252671354e0e37 (diff) | |
parent | ee92dd1683febd03e1d7ade40449ba114a67e1f5 (diff) | |
download | gitlab-ce-e9e79fdfdf7eee14efa9c5e8038b46538b6ac5e3.tar.gz |
Merge branch 'fix-escaped-branches-in-compare' into 'master'
Unescape branch names in compare commit
The upgrade in GitLab v7.9 to Rails v4.1.9 caused all branch names in the compare commit mode to be escaped (e.g. `/` to `%2F`). The compare mode would not always work when comparing against branch names with a forward slash.
Opted to unescape the branch name rather than use a wildcard segment to prevent escaping slashes because it seems like a more sensible URL. The slashes in this case aren't really represented by a tree structure (e.g. /compare/one/two/branch..another/branch/here).
* Closes #1399
* Closes https://github.com/gitlabhq/gitlabhq/issues/9105
See merge request !582
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/compare_controller.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 03e6c381275..7c20b81c0b1 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -1,3 +1,5 @@ +require 'addressable/uri' + class Projects::CompareController < Projects::ApplicationController # Authorize before_action :require_non_empty_project @@ -7,8 +9,8 @@ class Projects::CompareController < Projects::ApplicationController end def show - base_ref = params[:from] - head_ref = params[:to] + base_ref = Addressable::URI.unescape(params[:from]) + head_ref = Addressable::URI.unescape(params[:to]) compare_result = CompareService.new.execute( current_user, |