Skip to content

fix: Duplicate Requests for checking if a url hosts PDF#56

Merged
OS-pedrogustavobilro merged 6 commits intomainfrom
fix/RMET-5141/pdf-check
Apr 17, 2026
Merged

fix: Duplicate Requests for checking if a url hosts PDF#56
OS-pedrogustavobilro merged 6 commits intomainfrom
fix/RMET-5141/pdf-check

Conversation

@OS-pedrogustavobilro
Copy link
Copy Markdown
Collaborator

Description

This PR moves logic for checking if a url is hosting a PDF from handleLoadUrl to webview.setDownloadListener. Instead of us explicitly checking the mime type by doing an HTTP request to the server before loading the url, we load the url and then wait for the webview to inform us if this is a file that can be downloaded, and then check if it's a PDF there.

This fixes an issue on ASPX and OutSystems Traditional Web Apps where multiple requests were triggering "Preparation" server action more than once when loading said web page in a WebView, even if the web page hosted no PDFs.

Context

References:

References:

Type of changes

  • Fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Refactor (cosmetic changes)
  • Breaking change (change that would cause existing functionality to not work as expected)

Tests

To test that the issue is fixed, install and compare the two APKs (signatures may not match so you may need to uninstall one when uninstalling the other)

In your computer access https://enmobile11-dev.outsystemsenterprise.com/ServiceCenter/General_Logs.aspx, and search for RMET-5141 Callback. Open the app and press "Button IAB WebView (bug)". After a second or two refresh the logs page, you'll see three logs for the old apk, and just 1 for the new apk.

To test general behavior with IAB after this change (including open PDFs), check the sample app:

Checklist

  • Code follows code style of this project
  • CHANGELOG.md file is correctly updated
  • Changes require an update to the documentation
    • Documentation has been updated accordingly

This was causing an issue on ASPX and Traditional Web Apps where multiple requests were triggering "Preparation" server action more than once when loading said web page in a WebView.

Given that they weren't trying to load PDFs to begin with, this shows how checking the pdf type before loading the webpage is probably not the way to go.

Instead, we use webview.setDownloadListener to listen when we receive a file that should be downloaded in the webview, and remove the checks from handleLoadUrl

References:
- https://outsystemsrd.atlassian.net/browse/RMET-5141
- https://success.outsystems.com/documentation/11/building_apps/application_logic/actions_in_web_applications/#preparation-actions
- https://outsystems.slack.com/archives/C04ND35707P/p1776336737181489
- https://developer.android.com/reference/android/webkit/DownloadListener
@OS-pedrogustavobilro OS-pedrogustavobilro requested review from a team, ItsChaceD, OS-ruimoreiramendes, andredestro, capacitor-bot, markemer and theproducer and removed request for a team April 16, 2026 17:45
Following PR comments #56 (review)

Co-authored-by: OS-ruimoreiramendes <rui.moreira.mendes@outsystems.com>
@OS-pedrogustavobilro OS-pedrogustavobilro merged commit 910e674 into main Apr 17, 2026
7 of 8 checks passed
@OS-pedrogustavobilro OS-pedrogustavobilro deleted the fix/RMET-5141/pdf-check branch April 17, 2026 08:40
OS-pedrogustavobilro added a commit to OutSystems/cordova-outsystems-inappbrowser that referenced this pull request Apr 17, 2026
* fix(android): Duplicate requests for checking if a url hosts PDF

Via native library update.

References:

- https://outsystemsrd.atlassian.net/browse/RMET-5141
- https://outsystemsrd.atlassian.net/browse/RPM-6744
- OutSystems/OSInAppBrowserLib-Android#56

* chore(release): Prepare for version 1.6.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants