diff options
author | Rémy Coutable <remy@rymai.me> | 2016-03-03 14:11:52 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-03-03 14:16:32 +0300 |
commit | dec4e89e5bc1a88933464a2898061a99fb34ce1c (patch) | |
tree | 136cee314a053f68e3632712b8eb3886ca2a3ae5 /app/controllers/users_controller.rb | |
parent | 7e710acc1c72de7d11ad393ee3e111e250e0cb66 (diff) |
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/
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 8 |
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 |