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

Fix issue where urls with special characters were not correctly deserialized #93

Merged
merged 2 commits into from Jan 26, 2021

Conversation

overcyn
Copy link

@overcyn overcyn commented Jan 25, 2021

Cherry-pick ResearchKit#1444

ORKPathRelativeToURL and ORKURLForRelativePath do not correctly mirror each other. ORKPathRelativeToURL percent encodes it's output whereas ORKURLForRelativePath does not percent decode it's input. These methods are used during serialization/deserialization, causing a restored ORKFileResult to not point at the same path as the original file result.

Fix is to replace the call to [NSURL fileURLWithFileSystemRepresentation:...] with [NSURL URLWithString:...]. This matches with the [standardizedURL absoluteString] call in ORKPathRelativeToURL. I do not believe it is necessary to check if the file is a directory given that we are not modifying the relative path. If the original url had a trailing slash, then the output path will have a trailing slash and vice versa.

Copy link

@eschramm eschramm left a comment

Choose a reason for hiding this comment

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

LGTM - I like your approach for submitting to ResearchKit and cherry-picking since it may take forever for them to look at it 🙄

@overcyn
Copy link
Author

overcyn commented Jan 26, 2021

Yeah it feels like that project is dead.

@overcyn overcyn merged commit 309b93f into CEVRelease-2.x Jan 26, 2021
@overcyn overcyn deleted the overcyn/url-deserialization branch January 26, 2021 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants