summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-03-04 20:59:58 +0000
committerDouwe Maan <douwe@gitlab.com>2016-03-04 20:59:58 +0000
commit3231ea10b7319f6fe50c0ec1407ddaac69089641 (patch)
tree80399efb19a1089a417298578717898b81dac627
parentec68d673b24687804b1e1aa4c86b2f8fbc9ba7fd (diff)
parentdec4e89e5bc1a88933464a2898061a99fb34ce1c (diff)
downloadgitlab-ce-3231ea10b7319f6fe50c0ec1407ddaac69089641.tar.gz
Merge branch 'fix/sentry-1182' into 'master'
In UsersController#calendar_activities, when Date isn't parsable, fallback to Date.today For some reason, GoogleBot accesses `/u/:username/calendar_activities` without a `:date` param, but then the view was trying to call `#to_s(:short)` which doesn't exist on `nil`, leading to the following Sentry report: https://sentry.gitlap.com/gitlab/gitlabcom/issues/1182/ See merge request !3074
-rw-r--r--app/controllers/users_controller.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4b1cf242885..e10c633690f 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -67,12 +67,8 @@ class UsersController < ApplicationController
end
def calendar_activities
- @calendar_date = Date.parse(params[:date]) rescue nil
- @events = []
-
- if @calendar_date
- @events = contributions_calendar.events_by_date(@calendar_date)
- end
+ @calendar_date = Date.parse(params[:date]) rescue Date.today
+ @events = contributions_calendar.events_by_date(@calendar_date)
render 'calendar_activities', layout: false
end