Skip to content

Commit

Permalink
Check that fields are class Date before using strftime
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Mar 21, 2024
1 parent e9fcec9 commit c2bfc4e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/whimsy/asf/podling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ def podlingStatus
if File.exist?(resource_yml)
rawYaml = Psych.load_file(resource_yml, permitted_classes: [Date, Symbol])
hash = { }
hash[:sga] = rawYaml[:sga].strftime('%Y-%m-%d') if rawYaml[:sga]
hash[:asfCopyright] = rawYaml[:asfCopyright].strftime('%Y-%m-%d') if rawYaml[:asfCopyright]
hash[:distributionRights] = rawYaml[:distributionRights].strftime('%Y-%m-%d') if rawYaml[:distributionRights]
hash[:ipClearance] = rawYaml[:ipClearance].strftime('%Y-%m-%d') if rawYaml[:ipClearance]
hash[:sga] = rawYaml[:sga].strftime('%Y-%m-%d') if rawYaml[:sga]&.class == Date
hash[:asfCopyright] = rawYaml[:asfCopyright].strftime('%Y-%m-%d') if rawYaml[:asfCopyright]&.class == Date
hash[:distributionRights] = rawYaml[:distributionRights].strftime('%Y-%m-%d') if rawYaml[:distributionRights]&.class == Date
hash[:ipClearance] = rawYaml[:ipClearance].strftime('%Y-%m-%d') if rawYaml[:ipClearance]&.class == Date
hash[:sourceControl] = rawYaml[:sourceControl]
hash[:wiki] = rawYaml[:wiki]
hash[:jira] = rawYaml[:jira]
Expand All @@ -346,7 +346,7 @@ def podlingStatus
hash[:news] = []
rawYaml[:news]&.each do |ni|
newsItem = {}
newsItem[:date] = ni[:date].strftime('%Y-%m-%d')
newsItem[:date] = ni[:date].strftime('%Y-%m-%d') if ni[:date]&.class == Date
newsItem[:note] = ni[:note]
hash[:news].push(newsItem)
end
Expand Down

0 comments on commit c2bfc4e

Please sign in to comment.