mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-26 21:34:05 +02:00
fix(InternalDownloadManager): set accept-encoding header on just the download task
This commit is contained in:
+3
-11
@@ -17,16 +17,8 @@ class InternalDownloadManager(
|
|||||||
) : AutoCloseable {
|
) : AutoCloseable {
|
||||||
|
|
||||||
private val tag = "InternalDownloadManager"
|
private val tag = "InternalDownloadManager"
|
||||||
private val client: OkHttpClient = OkHttpClient.Builder()
|
private val client: OkHttpClient =
|
||||||
.connectTimeout(30, TimeUnit.SECONDS)
|
OkHttpClient.Builder().connectTimeout(30, TimeUnit.SECONDS).build()
|
||||||
.addInterceptor { chain ->
|
|
||||||
val originalRequest = chain.request()
|
|
||||||
val newRequest = originalRequest.newBuilder()
|
|
||||||
.header("Accept-Encoding", "identity")
|
|
||||||
.build()
|
|
||||||
chain.proceed(newRequest)
|
|
||||||
}
|
|
||||||
.build()
|
|
||||||
private val writer = BinaryFileWriter(outputStream, progressCallback)
|
private val writer = BinaryFileWriter(outputStream, progressCallback)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +29,7 @@ class InternalDownloadManager(
|
|||||||
*/
|
*/
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun download(url: String) {
|
fun download(url: String) {
|
||||||
val request: Request = Request.Builder().url(url).build()
|
val request: Request = Request.Builder().url(url).addHeader("Accept-Encoding", "identity").build()
|
||||||
client.newCall(request)
|
client.newCall(request)
|
||||||
.enqueue(
|
.enqueue(
|
||||||
object : Callback {
|
object : Callback {
|
||||||
|
|||||||
Reference in New Issue
Block a user