Skip to content

Using a semicolon in a value in QueryParameters suddenly doesn't work anymore #3955

Open

Description

@dcristolovean

Describe the bug

I'm calling a REST API with some query parameters ([String : String]). The API call worked for months now. One value in the query is a string like "X;Y".
The server now receives only X and not the entire string.
I put this query dict in a RESTRequest that is simply passed to Amplify.API.get.

Any ideas what happened ? It might coincide with the update to 2.45.4 I did a few days ago.

PS: This suddenly became a huge issue, I realized I have values like this in 99% of the API calls. Having a ";" in any value in the query parameters, simply removes everything what's after the 1st semicolon.
I tried encoding it (%3B), not encoding it, nothing works. Amplify just kills it.

Steps To Reproduce

- Access any REST API call with Amplify that requires queryParameters and send a value with a semicolon somewhere in the middle.

Expected behavior

The server should receive the entire string, not only what's before the semicolon.

Amplify Framework Version

2.45.4

Amplify Categories

API

Dependency manager

Swift PM

Activity

  1. harsh62 commented on Jan 28, 2025

    @harsh62
    Contributor

    @dcristolovean Thanks for opening the issue, I will work on reproducing this in my local environment and get back to you.

  2. added
    apiIssues related to the API category
    on Jan 28, 2025
  3. dcristolovean commented on Jan 28, 2025

    @dcristolovean
    Author

    I did log the url with an interceptor and it seems the values are sent correctly (I think), as "x;y;z". Still the server now says it only gets "x".
    From Android, my colleague encodes them (which I also tried) so he sends "x%3By%3Bz" which works on the server somehow. Android Amplify seems to leave them be and actually has this thing in the final URL.

    The thing is I also tried to encode them, I can see the query parameters with %3B as soon as I pass them to Amplify, but the final url I see in the interceptor is still with ";"

    So I would say double failure here :) . 1. Why does Amplify change my %3B to ";" in the final URL. 2. (this surely is not for you) Why does my AWS Rest API not understand "x;y" ?

    Everything worked for weeks so far, just suddenly it doesn't work anymore.

  4. harsh62 commented on Jan 28, 2025

    @harsh62
    Contributor

    @dcristolovean What was the version you upgraded from?

  5. dcristolovean commented on Jan 28, 2025

    @dcristolovean
    Author

    2.45.x ....something less than 4 :) I don't remember. 1, 2 or 3 :)
    It's SPM and I deleted the Derived Data completely for other reasons, so it just downloaded the new version by itself.

  6. dcristolovean commented on Jan 28, 2025

    @dcristolovean
    Author

    Is it possible that a previous Amplify version was just encoding the ";" by itself ? That would explain why my server worked for me, even if I never encoded myself the ";" ?
    And now the new version doesn't do that by default, as seen in the url i logged in the interceptor ? What's also different is that the Android Amplify does actually encode the ; in the final url.

  7. harsh62 commented on Jan 28, 2025

    @harsh62
    Contributor

    Yeah.. That could definitely be possible, I don't see anything that changed from 2.45.0 to 2.45.4 that should affect encoding. Are you able to test this in the following 3 versions by manually setting the version in SPM?

    • 244.0
    • 2.43.0
    • 2.42.0

    And validate if you are seeing the same issue, atleast that would validate the hypothesis of something going wrong in one of the recent versions of Amplify Swift.

  8. dcristolovean commented on Jan 28, 2025

    @dcristolovean
    Author

    This is getting even more interesting:

    https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html
    The semicolon character (;) is not supported for any request URL query string and results in the data being split.

    Nice. But.. the problem is that now I can't send ";" encoded, as seen, Amplify removes my encoding.
    Yes I will try to change the versions to see, not much else to do...

  9. dcristolovean commented on Jan 28, 2025

    @dcristolovean
    Author

    OK, more info:

    1. 2.42.0 still logs my URL with ";" So no point in testing the newer ones

    2. THIS IS THE FIX, NOW IT WORKS:

    class RESTInterceptor: URLRequestInterceptor {

    func intercept(_ request: URLRequest) -> URLRequest {        
        var encodedRequest = request
        let urlString = (request.url?.absoluteString ?? "").replacingOccurrences(of: ";", with: "%3B")
        encodedRequest.url = URL(string: urlString)        
        return encodedRequest
    }
    

    }

    Yes, this is the most horrific workaround you've ever seen, I know :). BUT IT WORKS. Considering I'm also hitting your AWS REST APIs, this is clearly a problem. It seems it never worked in Amplify, my bad. But it worked for years in AWSMobileClient, I was always sending "x;y;z" and the SDK was handling it correctly. And it works on Android, that SDK never replaces his encoding and leaves it as it is.

    Let me know if you consider this an Amplify bug (which 100% it is :) ) and how to proceed from here.

  10. harsh62 commented on Jan 28, 2025

    @harsh62
    Contributor

    @dcristolovean Thanks for getting back and providing these details.. I'll keep this issue open as a bug, as Amplify Swift seems to be not doing encoding correctly whereas Android does.

    I'll keep this at relatively lower priority since you have workaround and its not blocking you.

  11. github-actions commented on Aug 20, 2026

    @github-actions
    Contributor

    This issue is now closed. Comments on closed issues are hard for our team to see.
    If you need more assistance, please open a new issue that references this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

  12. added
    pending-releaseCode has been merged but pending release Code has been merged but pending release
    on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiIssues related to the API categorybugSomething isn't workingpending-releaseCode has been merged but pending release Code has been merged but pending release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions