breautek commented on issue #634:
URL: 
https://github.com/apache/cordova-plugin-file/issues/634#issuecomment-2277992343

   The default cordova webview parses the format 
`https://localhost/__cdvfile_files__/filename.jpg`.
   
   It seems like the ionic webview does something slightly different.
   
   Historically `toURL` was meant to produce DOM-usable URLs which broke once 
Cordova stopped using the `file://` protocol to host local app content and 
instead using schemes. Which is why toURL changed to produce `http(s)://` urls 
so they get passed through the native asset loader and are not blocked by CORs.
   
   If the `AndroidInsecureFileModeEnabled` preference is enabled, the file 
plugin assumes that the webview is still operating in the older file protocol 
mode and `toURL` should continue to return `file://` paths similar to v6 
behaviour. But I don't know if the ionic webview responds to this preference or 
not. Alternatively you can continue to use `nativeURL` property which in most 
cases will be a `file://` path. On android it may also be a `content://` path 
depending on the source of the content.
   
   I don't consider this a bug with the file plugin. This will work as expected 
with the default webview that Cordova provides. It will be on the Ionic webview 
to parse/adapt the paths. Note that Cordova plugins can define custom path 
handlers which the file plugin does 
[here](https://github.com/apache/cordova-plugin-file/blob/master/src/android/FileUtils.java#L1242),
 so if the ionic webview when they build their 
[WebViewAssetLoader](https://developer.android.com/reference/androidx/webkit/WebViewAssetLoader),
 they could include plugin path handlers so that the webview can fully support 
the file plugin.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to