Skip to content

Commit

Permalink
fix: Normalize URLs on Ionic WebViews
Browse files Browse the repository at this point in the history
  • Loading branch information
Maistho committed Sep 12, 2018
1 parent 4206bc6 commit 9734e67
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/imgcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,18 @@ LOG_LEVEL_ERROR = 3;
// Returns a URL that can be used to locate a file
Helpers.EntryGetURL = function (entry) {
// toURL for html5, toURI for cordova 1.x
return (typeof entry.toURL === 'function' ? Helpers.EntryToURL(entry) : entry.toURI());
var url = (typeof entry.toURL === 'function' ? Helpers.EntryToURL(entry) : entry.toURI());

// Ionics webview has a URL normalization method (#223)
var ionicNormalizer = window.Ionic &&
((window.Ionic.WebView && window.Ionic.WebView.convertFileSrc) ||
window.Ionic.normalizeURL);

if (typeof ionicNormalizer === "function") {
url = ionicNormalizer(url);
}

return url;
};

// Returns the full absolute path from the root to the FileEntry
Expand Down

0 comments on commit 9734e67

Please sign in to comment.