Commit 3231ea10 authored by Douwe Maan's avatar Douwe Maan

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
parents ec68d673 dec4e89e
...@@ -67,12 +67,8 @@ class UsersController < ApplicationController ...@@ -67,12 +67,8 @@ class UsersController < ApplicationController
end end
def calendar_activities def calendar_activities
@calendar_date = Date.parse(params[:date]) rescue nil @calendar_date = Date.parse(params[:date]) rescue Date.today
@events = [] @events = contributions_calendar.events_by_date(@calendar_date)
if @calendar_date
@events = contributions_calendar.events_by_date(@calendar_date)
end
render 'calendar_activities', layout: false render 'calendar_activities', layout: false
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment