Fix: fileCopyUri should include the URI schema#527
Merged
vonovak merged 1 commit intoreact-native-documents:masterfrom Jan 19, 2022
Merged
Fix: fileCopyUri should include the URI schema#527vonovak merged 1 commit intoreact-native-documents:masterfrom
fileCopyUri should include the URI schema#527vonovak merged 1 commit intoreact-native-documents:masterfrom
Conversation
Make the `fileCopyUri` be an actual URI and include the schema prefix (usually `file:/`) It already works that way on iOS
This was referenced Jan 18, 2022
Member
|
thank you for the PR and the comprehensive description! :) |
7 tasks
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Make the
fileCopyUribe a URI string and include the schema prefix (usuallyfile:/)fileCopyUrihasfile://prefix on iOS but doesn't on Android #526A URI should begin with the schema prefix
In iOS
fileCopyUrialready works that wayMissing the schema prefix causes a problem when you try to use
fileCopyUriwithfetchto upload a fileWhy
.toURI().toString()This was the only method I've found that returned the schema as part of the string
The same thing is used in RN image picker here
Difference between
file:/andfile:///Since on
iOSfileCopyUriis returned with afile:///prefix - you might be wondering if this is a problem.According to wikipedia
file:/andfile:///are the same thing: https://en.wikipedia.org/wiki/File_URI_scheme#How_many_slashes.3FTest Plan
I've manually tested the changes in the example app and in an external app
Before (no
file:/prefix forfileCopyUri)After
Sample video (after) in our app:
2022-01-18_21-40-23.mp4
fileCopyUristarts with a scheme and addedfile:if it didn'tSample for the same in iOS
No iOS change, but just showing how it already works there:

What's required for testing (prerequisites)?
This can be manually tested in the example app
What are the steps to reproduce (after prerequisites)?
(Or any button that passes a
copyToDocument Picker Option)fileCopyUri- it should contain the URI schema in the beginning e.g.file:/Compatibility
Checklist
README.md