Skip to content

[Bug]: $after querystring parameter gets added multiple times #1932

@cdgipson

Description

@cdgipson

What happened?

Ran the initial request with ?$first=5.

http://localhost:5000/api/StaffType?$first=5

Then ran the next link, it only contained one $first and one $after.

http://localhost:5000/api/StaffType?$first=5&$after=W3siRW50aXR5TmFtZSI6IlN0YWZmVHlwZSIsIkZpZWxkTmFtZSI6IklkIiwiRmllbGRWYWx1ZSI6OSwiRGlyZWN0aW9uIjowfV0=

The following nextLink contained two $after parameters.

http://localhost:5000/api/StaffType?$first=5&$after=W3siRW50aXR5TmFtZSI6IlN0YWZmVHlwZSIsIkZpZWxkTmFtZSI6IklkIiwiRmllbGRWYWx1ZSI6OSwiRGlyZWN0aW9uIjowfV0%3D&$after=W3siRW50aXR5TmFtZSI6IlN0YWZmVHlwZSIsIkZpZWxkTmFtZSI6IklkIiwiRmllbGRWYWx1ZSI6MTcsIkRpcmVjdGlvbiI6MH1d

When you follow that link it results in the following error.

{
"error": {
"code": "BadRequest",
"message": "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.\n at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)\n at System.Convert.FromBase64String(String s)\n at Azure.DataApiBuilder.Core.Resolvers.SqlPaginationUtil.Base64Decode(String base64EncodedData) in /src/src/Core/Resolvers/SqlPaginationUtil.cs:line 516\n at Azure.DataApiBuilder.Core.Resolvers.SqlPaginationUtil.ParseAfterFromJsonString(String afterJsonString, PaginationMetadata paginationMetadata, ISqlMetadataProvider sqlMetadataProvider, String entityName, RuntimeConfigProvider runtimeConfigProvider) in /src/src/Core/Resolvers/SqlPaginationUtil.cs:line 285",
"status": 400
}
}

I expected the endpoint to return the nextLink only containing one $after parameter, which points to the next set of records based upon the request that generated the response.

Version

0.8.52

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

REST

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcriCustomer Reported issuetriageissues to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions