Skip to content

Chucker corrupts image resources. #225

@MiSikora

Description

@MiSikora

📢 Describe the bug

If OkHttp client with the ChuckerInterceptor is used for image downloads then the requests fail.

💣 To Reproduce

  1. Run the sample project. - https://github.com/MiSikora/Chucker-Bug
  2. Run the app.
  3. Select the check box to enable Chucker.
  4. Press either Coil or Picasso buttons.

🔧 Expected behavior

The image should be downloaded and displayed in the ImageView. It should work in the same way as if the ChuckerInterceptor was disabled.

📷 Screenshots

Stack trace for Picasso.

java.io.IOException: Failed to decode stream.
  at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:161)
  at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:229)
  at com.squareup.picasso.RequestCreator.get(RequestCreator.java:429)
  at io.mehow.demo.MainActivity$onCreate$3$1.invoke(MainActivity.kt:54)
  at io.mehow.demo.MainActivity$onCreate$3$1.invoke(MainActivity.kt:23)
  at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Stack trace for Coil.

java.lang.IllegalStateException: BitmapFactory returned a null Bitmap. Often this means BitmapFactory could not decode the image data read from the input source (e.g. network or disk) as it's not encoded as a valid image format.
  at coil.decode.BitmapFactoryDecoder.decode(BitmapFactoryDecoder.kt:156)
  at coil.RealImageLoader$loadData$2.invokeSuspend(RealImageLoader.kt:392)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655)

📱 Smartphone

  • Device: Any Device
  • OS: Any OS
  • Lib version: 3.1.1

📄 Additional context

Issue does not exist in 3.1.0. It was introduced with 3.1.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions