@@ -175,11 +175,22 @@ LOG_LEVEL_ERROR = 3;
175
175
return ( Helpers . isCordovaAndroid ( ) && device . version && ( device . version . indexOf ( '2.' ) === 0 || device . version . indexOf ( '3.' ) === 0 ) ) ;
176
176
} ;
177
177
178
+ // special case for #223 #237 #246
179
+ Helpers . ionicNormalizer = window . Ionic &&
180
+ ( ( window . Ionic . WebView && window . Ionic . WebView . convertFileSrc ) || window . Ionic . normalizeURL ) ;
181
+
182
+ // check if ionic webview convertfilesrc function exist
183
+ Helpers . isIonicNormalizerFunctionExist = function ( ) {
184
+ return ( typeof Helpers . ionicNormalizer === 'function' ) ;
185
+ } ;
186
+
178
187
// Fix for #42 (Cordova versions < 4.0)
179
188
Helpers . EntryToURL = function ( entry ) {
180
189
if ( Helpers . isCordovaAndroidOlderThan4 ( ) && typeof entry . toNativeURL === 'function' ) {
181
190
return entry . toNativeURL ( ) ;
182
- } else if ( typeof entry . toInternalURL === 'function' ) {
191
+ } else if (
192
+ ! Helpers . isIonicNormalizerFunctionExist ( ) && // Fix for #223 #237 #246
193
+ ( typeof entry . toInternalURL === 'function' ) ) {
183
194
// Fix for #97
184
195
return entry . toInternalURL ( ) ;
185
196
} else {
@@ -190,7 +201,9 @@ LOG_LEVEL_ERROR = 3;
190
201
// Returns a URL that can be used to locate a file
191
202
Helpers . EntryGetURL = function ( entry ) {
192
203
// toURL for html5, toURI for cordova 1.x
193
- return ( typeof entry . toURL === 'function' ? Helpers . EntryToURL ( entry ) : entry . toURI ( ) ) ;
204
+ var url = ( typeof entry . toURL === 'function' ? Helpers . EntryToURL ( entry ) : entry . toURI ( ) ) ;
205
+ // Fix for #223 #237 #246
206
+ return Helpers . isIonicNormalizerFunctionExist ( ) ? Helpers . ionicNormalizer ( url ) : url ;
194
207
} ;
195
208
196
209
// Returns the full absolute path from the root to the FileEntry
0 commit comments