Smartling / api-sdk-net

.Net SDK for integrating with the Smartling API. The Smartling API allows developers to upload language specific resource files and download the translations of those files for easy integration within their application. http://docs.smartling.com
Apache License 2.0
1 stars 6 forks source link

Ampersand in fileUri is not escaped correctly #21

Closed dimitrystd closed 5 years ago

dimitrystd commented 5 years ago

Steps:

Actual: You will get error

{
    "response": {
        "code": "VALIDATION_ERROR",
        "errors": [
            {
                "key": "unknown.field",
                "message": "The field  G.xml was not expected. Please consult the documentation to verify the fields you are submitting.",
                "details": {
                    "field": " G.xml"
                }
            },
            {
                "key": "file.not.found",
                "message": "The file \"D \" could not be found",
                "details": {
                    "field": "fileUri"
                }
            }
        ]
    }
}

This is because smartling got

https://api.stg.smartling.net/files-api/v2/projects/xxx/file/last-modified?fileUri=D%20&%20G.xml

You may notice that only spaces were urlencoded by & is unencoded. As result FAPI thinks that you send 2 parameters

DoD:

dimitrystd commented 5 years ago

Commits above were made for File API only. We may expect similar bug for other APIs. I will update DoD in the description.

dotnetrocks commented 5 years ago

@dimitrystd So is it still open or closed?

dimitrystd commented 5 years ago

I closed it but ideally we should fix other places and add tests