From dec4e89e5bc1a88933464a2898061a99fb34ce1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 3 Mar 2016 12:11:52 +0100 Subject: [PATCH] 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/ --- app/controllers/users_controller.rb | 8 ++------ 1 file 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