Skip to content

Commit fdfe8aa

Browse files
adityak74jcesarmobile
authored andcommitted
fix: account port on resolving uri path (#321)
1 parent cb4c491 commit fdfe8aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/android/com/ionicframework/cordova/webview/AndroidProtocolHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ public InputStream openFile(String filePath) throws IOException {
7474
}
7575

7676
public InputStream openContentUrl(Uri uri) throws IOException {
77-
String realPath = uri.toString().replace(uri.getScheme() + "://" + uri.getHost() + WebViewLocalServer.contentStart, "content:/");
77+
Integer port = uri.getPort();
78+
String realPath;
79+
if (port == -1) {
80+
realPath = uri.toString().replace(uri.getScheme() + "://" + uri.getHost() + WebViewLocalServer.contentStart, "content:/");
81+
} else {
82+
realPath = uri.toString().replace(uri.getScheme() + "://" + uri.getHost() + ":" + port + WebViewLocalServer.contentStart, "content:/");
83+
}
7884
InputStream stream = null;
7985
try {
8086
stream = context.getContentResolver().openInputStream(Uri.parse(realPath));

0 commit comments

Comments
 (0)