Instabug / Instabug-Android

In-app feedback and bug reporting tool for apps.
https://instabug.com/
Other
188 stars 38 forks source link

Issue in InstabugOkhttpInterceptor: isFileDownload Flag Not Reset, Causing Inconsistent Response Logging #487

Open Zishanr opened 2 days ago

Zishanr commented 2 days ago

Steps to Reproduce the Problem

There is a issue in the InstabugOkhttpInterceptor class of the Instabug Android SDK. The isFileDownload flag, used to determine if an API call response body should be logged, remains true across multiple API calls. This results in inconsistent logging of the response body, especially for file download APIs, where sometimes the response body is not captured.

  1. Implement the InstabugOkhttpInterceptor in an Android project with APIs that include both standard and file download requests.
  2. Make several API calls, including file download first and then non-file download requests.
  3. Observe the response logging behaviour.

Flag in Instabug library codebase

Screenshot 2024-10-18 at 4 13 40 PM

Missing body from the response (Instabug dashboard screenshot)

Screenshot 2024-10-18 at 4 43 28 PM

Expected Result of response (Instabug dashboard screenshot) Screenshot 2024-10-18 at 5 22 37 PM

Expected Behavior

Each API call's response body should be logged consistently, with the isFileDownload flag properly resetting between API calls.

Actual Behavior

Once the isFileDownload flag is set to true for a file download API call, it does not reset. This prevents response bodies from being logged in subsequent API calls, leading to inconsistent network logs.

Additional Information:

Issue appears when: Multiple API calls are made in quick succession, potentially involving file downloads. Relevant code section: The handling of the isFileDownload flag inside InstabugOkhttpInterceptor.

Instabug integration code

Make sure to remove your app token.

SDK Version

13.4.1

Android Version

15

Device Model

Samsung S23

[Optional] Project That Reproduces the Issue

yaraabdelhakiim commented 2 days ago

Hi @Zishanr, thank you for reporting this 🙏🏻 We're aware of this issue and it will be fixed in the next release.