Skip to content

Conversation

@OS-pedrogustavobilro
Copy link
Contributor

Description

Fixes a bug where uploadFile with non-empty httpOptions.params would result in an error:

java.lang.IllegalStateException: Cannot set request property after connection is made

The cause being IONFLTRConnectionHelper#setupConnection was writing params to the connection's outputStream for PUT and POST requests (which are typically for upload), and later we tried to call connection.setRequestProperty, but the connection was already ongoing, causing the exception.

The fix involved changing how params are passed. For multipart/form-data, the params are written in the body in that Content-Type's format, as it was already happening with httpOptions.formData(which may not actually be used atm, but was left for backwards compatibility). For any other kind of request, since the body for upload file will contain binary data, we set the params in the url, like it already happens for download.

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

Refer to these test apps from OutSystems that add params to downloads and uploads:

  1. Before (has error when trying to upload)
  2. After (upload succeeds)

Checklist

  • CHANGELOG.md file is correctly updated
  • Changes require an update to the documentation
    • Documentation has been updated accordingly

@OS-pedrogustavobilro OS-pedrogustavobilro requested a review from a team January 9, 2026 10:02
@OS-pedrogustavobilro OS-pedrogustavobilro self-assigned this Jan 9, 2026
@OS-pedrogustavobilro OS-pedrogustavobilro changed the title Fix/rmet 4892/transfer url params fix: upload with params Jan 9, 2026
@OS-pedrogustavobilro OS-pedrogustavobilro merged commit f2b29f0 into main Jan 12, 2026
1 check passed
@OS-pedrogustavobilro OS-pedrogustavobilro deleted the fix/RMET-4892/transfer-url-params branch January 12, 2026 13:21
OS-pedrogustavobilro added a commit to ionic-team/capacitor-file-transfer that referenced this pull request Jan 12, 2026
OS-pedrogustavobilro added a commit to ionic-team/capacitor-file-transfer that referenced this pull request Jan 14, 2026
* fix(android): Upload with params

By 1.0.3 of native library.

References:

- https://outsystemsrd.atlassian.net/browse/RMET-4892
- ionic-team/ion-android-filetransfer#12

* chore: More parameters in example app upload
OS-pedrogustavobilro added a commit to ionic-team/capacitor-file-transfer that referenced this pull request Jan 14, 2026
* fix(android): Upload with params

By 1.0.3 of native library.

References:

- https://outsystemsrd.atlassian.net/browse/RMET-4892
- ionic-team/ion-android-filetransfer#12

* chore: More parameters in example app upload
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.

4 participants