Skip to content

Commit 5bc88bb

Browse files
committed
Fix Android redirects when it is http, change to https
#2161
1 parent 1ea6dde commit 5bc88bb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/services/tools.ts

+8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ export const getSecureUrl = async (mediaUrl: string) => {
4343
}, finalUrl)
4444
if (redirectResponse?.request?.responseURL) {
4545
finalUrl = redirectResponse.request.responseURL
46+
47+
/*
48+
Sometimes the final redirected URL will begin with http. Change it to https
49+
to avoid "cleartext not allowed" errors on Android.
50+
*/
51+
if (mediaUrl.indexOf('http://') >= 0) {
52+
finalUrl = mediaUrl.replace(/http:\/\//g, 'https://')
53+
}
4654
}
4755
}
4856
} catch (error) {

0 commit comments

Comments
 (0)