Repository navigation
v0.3.0
Works on current Cordova and Capacitor again. Tested on cordova-android 14 and 15, cordova-ios 8, and Capacitor 7 and 8.
- (Security, iOS and Android) the
nameoption was used as a file path as-is, so a name such as../filewrote outside the plugin's folder (and on iOS deleted the existing file there first). This could be exploited when an app passes a server-supplied file name. Only the last path component ofnameis used now. - (Security, Android) removed debug logging that printed full URLs and file paths to logcat; signed URLs could leak access tokens there.
- (Privacy, iOS) previewed and downloaded files are now saved in the app's temporary folder instead of
Documents, so they are no longer kept indefinitely or included in device backups. If your app relied on finding previewed files inDocuments, save a copy yourself before previewing. - (Privacy, Android) the plugin no longer requests the
WRITE_EXTERNAL_STORAGEpermission. It never needed it: files are written to app-specific storage. If your app needs that permission for its own code, declare it in your app'sconfig.xml. - (Android) replace the pinned
androidx.appcompat:appcompat:1.3.1withandroidx.core:core:1.13.0, the library the plugin actually uses. Supported Cordova and Capacitor versions already include it, so app dependency versions do not change. - (iOS) fix build on cordova-ios 8: the plugin no longer compiled, and its
cordova-plugin-add-swift-supportdependency failed during install. That dependency is removed; cordova-ios 8 supports Swift natively. - (iOS) a remote URL that returns an HTTP error (404, 403, ...) now calls the error callback instead of previewing the error page as the file.
- (iOS) URLs that are already percent-encoded are no longer encoded twice, which broke signed URLs and file names containing
#, spaces or accents (#45). - (Android) fix blank documents: local and base64 files opened in the viewer as empty pages on current cordova-android, because the plugin's
FileProvidershared its class name with cordova-android's own provider. The plugin now uses its own provider class (com.mostafa.previewanyfile.PreviewAnyFileProvider), authority (<applicationId>.previewanyfile.provider) and paths file (res/xml/preview_any_file_paths.xml), so it no longer conflicts with Capacitor or other plugins either. - (Android) remove the
cordova-plugin-androidxandcordova-plugin-androidx-adapterdependencies, which are not needed on supported platforms (#44). previewAssetnow calls the error callback when the asset cannot be loaded (it previously only logged to the console).- Declare minimum platforms (cordova-android 14, cordova-ios 8). Cordova projects on older platforms keep installing 0.2.9.
- README: Capacitor install, requirements and tested versions,
nativeURLvstoURL(), Android remote URL behaviour, working Ionic wrapper link (#47).
Install
cordova plugin add cordova-plugin-preview-any-file
Capacitor:
npm install cordova-plugin-preview-any-file
npx cap sync
Upgrading from 0.2.x? See the upgrade notes.