Fix: fileCopyUri
should include the URI schema
#527
Merged
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
fileCopyUri
be a URI string and include the schema prefix (usuallyfile:/
)fileCopyUri
hasfile://
prefix on iOS but doesn't on Android #526A URI should begin with the schema prefix
In iOS
fileCopyUri
already works that wayMissing the schema prefix causes a problem when you try to use
fileCopyUri
withfetch
to 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
iOS
fileCopyUri
is 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
fileCopyUri
starts 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
copyTo
Document Picker Option)fileCopyUri
- it should contain the URI schema in the beginning e.g.file:/
Compatibility
Checklist
README.md