summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-03-03 12:11:52 +0100
committerRémy Coutable <remy@rymai.me>2016-03-03 12:16:32 +0100
commitdec4e89e5bc1a88933464a2898061a99fb34ce1c (patch)
tree136cee314a053f68e3632712b8eb3886ca2a3ae5
parent7e710acc1c72de7d11ad393ee3e111e250e0cb66 (diff)
downloadgitlab-ce-fix/sentry-1182.tar.gz
In UsersController#calendar_activities, when Date isn't parsable, fallback to Date.todayfix/sentry-1182
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/
-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