Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse web redemption link strings more defensively #1976

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.net.Uri
import androidx.annotation.VisibleForTesting
import com.revenuecat.purchases.common.LogIntent
import com.revenuecat.purchases.common.PlatformInfo
import com.revenuecat.purchases.common.errorLog
import com.revenuecat.purchases.common.infoLog
import com.revenuecat.purchases.common.log
import com.revenuecat.purchases.deeplinks.DeepLinkParser
Expand Down Expand Up @@ -834,8 +835,13 @@ class Purchases internal constructor(
@ExperimentalPreviewRevenueCatPurchasesAPI
@JvmStatic
fun parseAsWebPurchaseRedemption(string: String): WebPurchaseRedemption? {
val uri = Uri.parse(string)
return DeepLinkParser.parseWebPurchaseRedemption(uri)
try {
val uri = Uri.parse(string)
return DeepLinkParser.parseWebPurchaseRedemption(uri)
} catch (@Suppress("TooGenericExceptionCaught") e: Throwable) {
errorLog("Error parsing URL: $string", e)
return null
}
}

/**
Expand Down