Skip to content
代码片段 群组 项目
提交 3f9bfb0c 编辑于 作者: Rémy Coutable's avatar Rémy Coutable
浏览文件

Merge branch 'blackst0ne-rails5-fix-tzinfo-invalid-timezone-identifier' into 'master'

[Rails5] Fix `TZInfo::InvalidTimezoneIdentifier` exception

See merge request gitlab-org/gitlab-ce!18640
No related branches found
No related tags found
无相关合并请求
......@@ -6,7 +6,7 @@ class CronParser
def initialize(cron, cron_timezone = 'UTC')
@cron = cron
@cron_timezone = ActiveSupport::TimeZone.find_tzinfo(cron_timezone).name
@cron_timezone = timezone_name(cron_timezone)
end
def next_time_from(time)
......@@ -24,6 +24,12 @@ def cron_timezone_valid?
private
def timezone_name(timezone)
ActiveSupport::TimeZone.find_tzinfo(timezone).name
rescue TZInfo::InvalidTimezoneIdentifier
timezone
end
# NOTE:
# cron_timezone can only accept timezones listed in TZInfo::Timezone.
# Aliases of Timezones from ActiveSupport::TimeZone are NOT accepted,
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册