-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cordova-plugin-file overwrites the global File variable #453
Comments
This plugin has its own Personally, I do agree, the plugin should avoid clobbering features provided by the browser. But changing this would probably require a discussion on the mailing list as this plugin is a dependency of several other plugins. I suppose the simplest change (and simplest migration) would just change the clobber space to |
@breautek how do I update the clobber space to using the explicit namespace cordova.file as I'm having this same problem. That, or is it possible to create a File Reference using the cordova plugin that will be able to be Read in my API? |
@JoCa96 where you able to resolve this issue? How? |
The only way to do this is to fork the plugin and change the cordova-plugin-file/plugin.xml Lines 48 to 50 in a4a7bfe
Doing so may break things that depend on this plugin however, and may require other changes within the plugin's JS sources itself. A safer workaround might be to capture a reference to the original |
@breautek Thanks man. |
@Go4th Sorry, I missed the notification for your comment. We were just able to remove the |
Probably duplicate of #316. |
I removed iOS from the title since this isn't actually iOS specific, it's part of the plugin for all platforms. |
duplicate #453 |
Bug Report
Hi, we had this plugin in our Capacitor project as a dependency of
cordova-plugin-advanced-http
.It is not possible to use the Browsers File API with this plugin in Capacitor on iOS.
The following snippet will not work correctly:
Problem
The
cordova-plugin-file
is overwriting the global/globalThis/window File variable.I never actively used this Plugin, but skimmed through the docs and it doesn't seem like this behaviour is intended.
What is expected to happen?
I expect to be able to use the Browsers
File
API as described by MDN to create a File instance.What does actually happen?
An incorrect File instance is created, which can not be used as describe by MDN to create a File instance.
Information
We are only building an iOS App, so I can only confirm this bug for iOS.
Command or Code
Create an Capacitor iOS project and install the
cordova-plugin-file
package.Build the iOS app and use XCode to build and run the App on an iPhone/iPad connected via USB.
Use Safari DevTools to debug the Capacitor App and run the following snippet.
Inspect the
file
variable or inspect theFile
protoype's constructor and you will notice that it is not the Browsers nativeFile
API.Environment, Platform, Device
Version information
Checklist
The text was updated successfully, but these errors were encountered: