Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOB-19790] Fix encoded data in migration #974

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

cdhoffmann
Copy link
Contributor

Fixes crash which happened when trying to set Data in FileSystemNamedCollection.

The crash occurred because the JSONSerialization.data(:_) method crashes internally when a top level fragment is not an accepted type. See here. When we attempted to set encoded data, the crash occurs.

To avoid the crash, we use the JSONSerialization.isValidJSONObject to check if the value can be used.
To successfully migrate the encoded data, we now encode the data as a string in the migrator before migrating it.

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #974 (bbfb306) into dev-v4.2.0 (9dad765) will decrease coverage by 0.05%.
The diff coverage is 84.62%.

@@              Coverage Diff               @@
##           dev-v4.2.0     #974      +/-   ##
==============================================
- Coverage       89.91%   89.85%   -0.05%     
==============================================
  Files             133      133              
  Lines            8331     8338       +7     
==============================================
+ Hits             7490     7492       +2     
- Misses            841      846       +5     

Copy link
Contributor

@kevinlind kevinlind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Were you able to test with Core's test app? Did you see any cases where the migrated data was not serializable?

@cdhoffmann
Copy link
Contributor Author

@kevinlind Just tested on the core test app and the issue was that we were setting the app group on the dev branch but not on main. I went ahead and removed that from our dev branch to avoid issues.

@cdhoffmann cdhoffmann merged commit 47e9199 into adobe:dev-v4.2.0 Oct 25, 2023
18 checks passed
@cdhoffmann cdhoffmann deleted the fixEncodedDataMigration branch October 25, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants