Skip to content

Commit

Permalink
Fix variable name for download https error
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdowney committed May 9, 2024
1 parent bb23a18 commit 62a875b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/services/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export const getSecureUrl = async (mediaUrl: string) => {
method: 'POST',
body: { url: mediaUrl }
})

const secureUrlInfo = response?.data || {}
const { secureUrl } = secureUrlInfo

if (secureUrl?.startsWith('https://')) {
finalUrl = secureUrl
}
Expand Down Expand Up @@ -48,8 +48,8 @@ export const getSecureUrl = async (mediaUrl: string) => {
Sometimes the final redirected URL will begin with http. Change it to https
to avoid "cleartext not allowed" errors on Android.
*/
if (mediaUrl.indexOf('http://') >= 0) {
finalUrl = mediaUrl.replace(/http:\/\//g, 'https://')
if (finalUrl.indexOf('http://') >= 0) {
finalUrl = finalUrl.replace(/http:\/\//g, 'https://')
}
}
}
Expand Down

0 comments on commit 62a875b

Please sign in to comment.