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.
This PR enables Pantry to read its legacy storage format (plist). This is necessary when upgrading from a pre-swift-3 version of the framework a current version, otherwise the storage contents will always be tried to read as JSON (which will fail) and the
unpack
method will ultimately returnnil
although all the data was still there.What this PR does is basically first trying to read the old format for downwards compatibility and only if that fails, read the storage contents as JSON.
You don't NEED to merge the PR if you don't want to as I can see this being a rare edge case but I wanted to offer it anyways. And I can totally see that 'reading the legacy format first' is a overhead that might be too big for the edge case it solves.
Also, I'm open for better approaches to fix this scenario if you have any. This is just a quick fix and honestly the first idea I had. But it works.