Fix for iOS with cordova-plugin-file >=8.1.3#381
Fix for iOS with cordova-plugin-file >=8.1.3#381fabiofabbri84 wants to merge 1 commit intoapache:masterfrom
Conversation
Historically I think I believe file transfer plugin technically still accepts
So I feel like the better approach is to make sure documentation are up to date with current standards, and for application code to use the proper method/properties depending on their use case. |
|
Well, the README.md says that this plugin works with the result of the .toURL() method, so I think the best path is to support all possible results of .toURL() and try to keep backward compatibility if you want to change this behaviour in future major versions (i think it's easy to recognize and support/convert a legacy url) |
Platforms affected
iOS
Motivation and Context
Since cordova-plugin-file 8.1.3, on iOS, urls returned by
Entry.toURL()are not anymore in'file://'format, but inwindow.CDV_ASSETS_URL + '/_app_file_'format (wherewindow.CDV_ASSETS_URL = scheme + '://' + hostname, and these values are defined in config.xml)Description
I added a function that returns the
'file://'url if the url starts withwindow.CDV_ASSETS_URL + '/_app_file_'. Then I used it to filter thefilePathandtargetvaluesI'm not sure if it is the best solution, but it works for me.
Testing
We have an app that had no issues with cordova-plugin-file <8.1.3 and cordova-plugin-file-transfer.
After an upgrade to cordova-plugin-file 8.1.3, we noticed file downloads with cordova-plugin-file-transfer was not working.
With this change to cordova-plugin-file-transfer, downloads are working again. As the additional function does nothing if the url does not start with
window.CDV_ASSETS_URL + '/_app_file_', it should have no side effectsChecklist
(platform)if this change only applies to one platform (e.g.(android))