api icon indicating copy to clipboard operation
api copied to clipboard

Comma-delimited parameters improperly handle percent encoding

Open quantatic opened this issue 3 years ago • 1 comments

Consider the following request: https://api.pushshift.io/reddit/search/comment/?q=science&fields=score,score_hidden.

I get the following response:

{
    "data": [
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": false
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        },
        {
            "score": 1,
            "score_hidden": true
        }
    ]
}

Now, consider the following request: https://api.pushshift.io/reddit/search/comment/?q=science&fields=score%2Cscore_hidden. I expect this request to be effectively identical, but the backend doesn't seem to handle the percent-encoded comma correctly:

{
    "data": [
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {},
        {}
    ]
}

quantatic avatar Sep 24 '22 17:09 quantatic

@quantatic is fields still working for you? (using ,), it gets ignored on my side.

gety9 avatar Feb 05 '23 19:02 gety9