Windows UWP: Different URL type for DestinationType.FILE_URI when using PictureSourceType.SAVEDPHOTOALBUM
Bug Report
Problem
When specifying DestinationType.FILE_URI, the URL types on Windows UWP are different for images captured by the camera than they are for images selected from the hard drive.
What is expected to happen?
The URLs returned by this plugin should have the same type independent of the picture source.
What does actually happen?
Camera.PictureSourceType.CAMERA=>ms-appdata:///local/CCapture.jpgCamera.PictureSourceType.SAVEDPHOTOALBUM=>blob:ms-appx://<APPID>/<GUID>
Information
Before 5.0.0, we used Camera.DestinationType.NATIVE_URI on Windows UWP, which would return URLs similar to what Camera.PictureSourceType.CAMERA does. However, this destination type was removed in https://github.com/apache/cordova-plugin-camera/pull/637
With 5.0.0, the best workaround I could come up with was patching CameraProxy.js:
const newContent = fileContent.replace(
/successCallback\(URL\.createObjectURL\(storageFile\)\);/g,
"successCallback('ms-appdata:///local/' + storageFile.name);"
);
Is there a reason why the Blob URLs were chosen as FILE_URI for Windows UWP? Could they be replaced by the URLs formerly returned for NATIVE_URI?
Note: https://github.com/apache/cordova-plugin-camera/pull/668 seems to already change this behavior
Command or Code
Complete options:
{
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM,
encodingType: Camera.EncodingType.JPEG,
mediaType: Camera.MediaType.PICTURE,
allowEdit: false,
correctOrientation: true,
targetWidth: undefined,
targetHeight: undefined,
}
Environment, Platform, Device
Windows UWP, Windows 10/2004
Version information
cordova 10.0.0 cordova-windows 7.0.1 cordova-plugin-camera 5.0.0
Checklist
- [x] I searched for existing GitHub issues
- #496 seems to be related
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above