[Grouple] Fix closing response on error

This commit is contained in:
2024-10-05 15:23:22 +03:00
parent eff26c8889
commit 6f7e1fcfb2
2 changed files with 4 additions and 2 deletions

View File

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

View File

@@ -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