Invalid characters (e.g. leading/trailing spaces) in branch/tag ID on the compare section cause errors
Current state: Occassionally someone will paste in a branch/tag ID from a JIRA ticket into a Gitlab compare, and be given a 500 error in the browser. If a trailing space is copied from the JIRA ticket and pasted into Gitlab, it produces an error that's not obvious to the user.
Desired state: It'd be ideal if the leading/trailing spaces were automatically removed before submitting, or if there was a clear indication to the user that they did something wrong.
Steps to reproduce:
- Navigate to desired project
- View commits
- Select "Compare" tab
- Leave "from" option as master
- Type in the name of a legitimate branch/tag ID, but add a trailing space after it. In our case it's "bmenard/core-124 "
- Click Compare
- Observe 500 error in web browser
This log is thrown in the rails logs:
` Started GET "/api/v3/projects/3/merge_requests/2636/notes?private_token=[FILTERED]" for 127.0.0.1 at 2016-06-13 14:48:38 -0500
Rugged::InvalidError (Failed to parse revision specifier - Invalid pattern 'bmenard/core-124 '):
app/models/repository.rb:763:in merge_base' app/models/repository.rb:763:in merge_base'
app/models/project.rb:390:in merge_base_commit' app/controllers/projects/compare_controller.rb:23:in show'
lib/gitlab/middleware/readonly_geo.rb:22:in call'