[Grouple] Fix closing response on error

master
Koitharu 2 years ago
parent eff26c8889
commit 6f7e1fcfb2
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -1 +1 @@
total: 1118
total: 1120

@ -11,6 +11,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.internal.closeQuietly
import okhttp3.internal.headersContentLength
import org.json.JSONArray
import org.jsoup.nodes.Element
@ -317,7 +318,7 @@ internal abstract class GroupleParser(
SortOrder.UPDATED -> "updated"
SortOrder.ADDED,
SortOrder.NEWEST,
-> "created"
-> "created"
SortOrder.RATING -> "votes"
else -> "rate"
@ -381,6 +382,7 @@ internal abstract class GroupleParser(
private fun Response.checkAuthRequired(): Response {
val lastPathSegment = request.url.pathSegments.lastOrNull() ?: return this
if (lastPathSegment == "login") {
closeQuietly()
throw AuthRequiredException(source)
}
return this

Loading…
Cancel
Save