File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
android/src/main/java/com/rnziparchive Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -181,9 +181,18 @@ public void run() {
181181 final long size ;
182182
183183 try {
184- assetsInputStream = getReactApplicationContext ().getAssets ().open (assetsPath );
185- AssetFileDescriptor fileDescriptor = getReactApplicationContext ().getAssets ().openFd (assetsPath );
186- size = fileDescriptor .getLength ();
184+ if (assetsPath .startsWith ("content://" )) {
185+ var assetUri = Uri .parse (assetsPath );
186+ var contentResolver = getReactApplicationContext ().getContentResolver ();
187+
188+ assetsInputStream = contentResolver .openInputStream (assetUri );
189+ var fileDescriptor = contentResolver .openFileDescriptor (assetUri , "r" );
190+ size = fileDescriptor .getStatSize ();
191+ } else {
192+ assetsInputStream = getReactApplicationContext ().getAssets ().open (assetsPath );
193+ AssetFileDescriptor fileDescriptor = getReactApplicationContext ().getAssets ().openFd (assetsPath );
194+ size = fileDescriptor .getLength ();
195+ }
187196 } catch (IOException e ) {
188197 promise .reject (null , String .format ("Asset file `%s` could not be opened" , assetsPath ));
189198 return ;
You can’t perform that action at this time.
0 commit comments