Use a copy of the files when signing with a memorySigner
#6
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.
I've found that when using a
memorySigner
, the original files from the template get corrupted in subsequent calls to theCreateSignedAndZippedPersonalizedPassArchive
method. I think that similar to thefileSigner
implementation, thememorySigner
one should work with a temporary copy of the template files and not affect the original ones. Once the pass is signed and compressed, the temporary copy should be removed, as thefileSigner
does.Given that in Go the maps are passed by reference and not by value, the
CreateSignedAndZippedPersonalizedPassArchive
method is propagating themanifest.json
andsignature
files calculated in a first call, to the subsequent calls. For example, in a first call, it correctly generates the followingmanifest.json
file and a valid Apple Wallet pass:However, In a second call, the
manifest.json
file would have these extra entries that make the generated pass to be corrupted:This PR makes a deep copy of the template files and lets the GC deal with removing the copy once the signing/compressing of the files is completed and the copy is not referenced anymore.