Cordova 相机插件:不允许加载本地资源 (content://)

Cordova Camera Plugin: Not allowed to load local resource (content://)

我有一个 Cordova 应用程序。在应用程序的某些部分,我让用户从图库中选择一张照片或使用相机拍摄一张照片。为此,我使用 cordova-plugin-camera.

问题是当用户用相机拍照时,预览是好的,但是当他们从图库中选择照片时,照片的预览就坏了。

这是我为损坏的预览得到的错误: Not allowed to load local resource: content://com.android.providers.media.documents/document/image%3A6717.

我正在使用 navigator.camera.getPicture 函数和 destinationType: Camera.DestinationType.NATIVE_URL

这发生在 Android 台设备上。你知道是什么原因造成的吗?

顺便说一下,我已经将 <access origin="content:///*" /> 添加到 config.xml 文件中,但是它不起作用。

解决方案是使用 cordova-plugin-filepath 将内容 URI 转换为本机路径: