ElectronBuilder: Allow Date/Time deserialization #14205
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?The
ElectronBuilder
strategy usesYAML#safe_load
to parse YAML content and this limits deserialization to appropriate classes. We recently encountered aTried to load unspecified class: Time
error when using theElectronBuilder
strategy on alatest-mac.yml
file containingreleaseDate: 2022-12-01T02:02:46.419Z
.The electron-builder YAML files we usually encounter use single quotes around the
releaseDate
value to ensure it's treated as a string (e.g.,releaseDate: '2022-10-12T17:55:26.718Z'
) and this is what we do inelectron_builder_spec.rb
. The aforementioned YAML file doesn't use single quotes around the value, so it's treated as a timestamp and apparently this makes Psych useTime
(which#safe_load
doesn't allow by default).There's something to be said for upstream simply using single quotes around this value (the electron-builder documentation seems to suggest the value should be a string) but that's not something we can directly control and we may encounter other files like this in the future. With that in mind, this PR modifies the related
#safe_load
call to allowTime
(andDate
for good measure), which will resolve the aforementioned error and allow theElectronBuilder
strategy to work as expected in this scenario.