Sparkle: Handle ArgumentError from Time#parse
This commit is contained in:
parent
a5768de0c3
commit
23f8cb9f4a
@ -75,7 +75,12 @@ module Homebrew
|
|||||||
version ||= (item > "version").first&.text&.strip
|
version ||= (item > "version").first&.text&.strip
|
||||||
|
|
||||||
title = (item > "title").first&.text&.strip
|
title = (item > "title").first&.text&.strip
|
||||||
pub_date = (item > "pubDate").first&.text&.strip&.presence&.yield_self { |d| Time.parse(d) }
|
pub_date = (item > "pubDate").first&.text&.strip&.presence&.yield_self do |date_string|
|
||||||
|
Time.parse(date_string)
|
||||||
|
rescue ArgumentError
|
||||||
|
# Omit unparseable strings (e.g. non-English dates)
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
if (match = title&.match(/(\d+(?:\.\d+)*)\s*(\([^)]+\))?\Z/))
|
if (match = title&.match(/(\d+(?:\.\d+)*)\s*(\([^)]+\))?\Z/))
|
||||||
short_version ||= match[1]
|
short_version ||= match[1]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user