Skip to content

Commit e5290d2

Browse files
committed
Navigation: Added support for authority-less URI schemes.
For URI schemes like "qrc:" (Qt resource) which do not include an authority but only a path the method $.mobile.path.getLocation() incorrectly returns a URL with a double slash after the scheme name. In a Qt Webkit ThinClient application this resulted in continuously adding up slashes in front of the path (e.g. "qrc://////index.html").
1 parent 08efc5b commit e5290d2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

js/navigation/path.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@ define([
5050
// mimic the browser with an empty string when the hash is empty
5151
hash = hash === "#" ? "" : hash;
5252

53-
// Make sure to parse the url or the location object for the hash because using location.hash
54-
// is autodecoded in firefox, the rest of the url should be from the object (location unless
55-
// we're testing) to avoid the inclusion of the authority
56-
return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
53+
if (!uri.doubleSlash) {
54+
// Make sure to parse the url or the location object for the hash because using location.hash
55+
// is autodecoded in firefox, the rest of the url should be from the object (location unless
56+
// we're testing) to avoid the inclusion of the authority
57+
return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
58+
} else {
59+
// support URI schemes which contain only a path and no authority (e.g. "qrc:")
60+
return uri.protocol + uri.pathname + uri.search + hash;
61+
}
5762
},
5863

5964
//return the original document url

0 commit comments

Comments
 (0)