Skip to content

Conversation

@maniktyagi04
Copy link

Description

Fixes #8270

This PR fixes two bugs in the buildUrlParams function:

  1. Missing assignment: Array parameter values had a trailing & that wasn't removed
  2. Deprecated method: Replaced substr(1) with substring(1)

Changes

  • Line 336: Assign the slice result to remove trailing & from array parameters
  • Line 346: Replace deprecated substr() with substring()
  • Line 321: Export buildUrlParams for testing
  • Added test cases to verify the fixes

Testing

  • ✅ All existing tests pass (53 tests in core, 41 in CLI)
  • ✅ New test cases verify array parameter formatting and initial ampersand removal

Impact

  • Type: Bug fix
  • Breaking: No
  • Platforms: All (affects HTTP plugin URL parameter building)

Before

buildUrlParams({ tags: ['javascript', 'typescript'], key: 'value' })
// Returns: "tags=javascript&tags=typescript&&key=value" ❌
//                                            ^^ double ampersand

After

buildUrlParams({ tags: ['javascript', 'typescript'], key: 'value' })
// Returns: "tags=javascript&tags=typescript&key=value" ✅

Additional Notes

  • The substr() method is deprecated and should be replaced with substring() or slice()
  • Both fixes are backward compatible and don't change the API

…ubstr

Two fixes in buildUrlParams function:
1. Assign slice result to remove trailing '&' from array parameters
2. Replace deprecated substr() with substring()

Before: buildUrlParams({tags: ['a', 'b']}) returned 'tags=a&tags=b&&...'
After: buildUrlParams({tags: ['a', 'b']}) returns 'tags=a&tags=b&...'

Fixes: Double ampersand in URL parameters with arrays
Fixes: Deprecated substr usage
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 4, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 5, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 6, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 7, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 8, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 9, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 10, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 11, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 12, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 13, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 14, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 15, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 16, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 17, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 18, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 19, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 20, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 21, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 22, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 23, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 24, 2025
riderx pushed a commit to Cap-go/capacitor-plus that referenced this pull request Dec 25, 2025
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.

bug(core): buildUrlParams creates double ampersands for array parameters

1 participant