Skip to content

Commit

Permalink
Reduce number of exit points
Browse files Browse the repository at this point in the history
The method `onReceivedHttpError` did have 3 exit points (`return`), but Codacy only allows us 2, so error handling for `request?.url` and `view?.context` was combined. Seems debatable, what's more readable, but the rules are the rules.

Signed-off-by: Elv1zz <[email protected]>
  • Loading branch information
Elv1zz committed Oct 27, 2023
1 parent 01d05e2 commit 4cc7fa0
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ open class NextcloudWebViewClient(val supportFragmentManager: FragmentManager) :
) {
val errorCode = errorResponse?.statusCode ?: return
if (errorCode == HttpStatus.SC_BAD_REQUEST) {
Log_OC.w(tag, "WebView failed with error code $errorCode; remove key chain aliases")
// chosen client certificate alias does not seem to work -> discard it
val failingUrl = request?.url ?: return
val context = view?.context ?: return
val failingUrl = request?.url
val context = view?.context
if (failingUrl == null || context == null) {
return
}
Log_OC.w(tag, "WebView failed with error code $errorCode; remove key chain aliases")
AdvancedX509KeyManager(context).removeKeys(failingUrl)
}
}
Expand Down

0 comments on commit 4cc7fa0

Please sign in to comment.