cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

cordova.file.applciationDirectory has wrong URL scheme on windows10

Open breminnyi opened this issue 5 years ago • 0 comments
trafficstars

Bug Report

Field cordova.file.applicationDirectory returns wrong URL scheme for windows10 platform: ms-appx:/// instead of ms-appx-web:///.

What is expected to happen?

Correct URL to file, that starts from ms-appx-web:/// if platform is windows10, file is loaded successfully.

What does actually happen?

URL starts from ms-appx:/// and file wasn't loaded.

Command or Code

Create empty cordova project: cordova create Add windows platform: cordova platform add windows Add the plugin: cordova plugin add cordova-plugin-file

Also put access tag in config.xml file: <access origin="*" /> (maybe it isn't necessary, IDK)

Now add some code into www/js/index.js onDeviceReady function: var img = new Image(); img.src = cordova.file.applicationDirectory + 'www/img/logo.png'; var div = document.getElementsByClassName('app')[0]; div.appendChild(img);

Run the application and observe the actual result.

Workaround

Replacing all occurrences ms-appx:/// with ms-appx-web:/// in file cordova-plugin-file/src/windows/FileProxy.js should fix the problem. But I'm interested in proper fix.

Environment, Platform, Device

windows10

Version information

Cordova CLI version: 9.0.0 ([email protected]) Plugin version: cordova-plugin-file 6.0.2 "File"

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

breminnyi avatar Oct 19 '20 17:10 breminnyi