Skip to content

SparseFieldsetsMixin catches invalid key from URL #519

@tokwiat

Description

@tokwiat

Hi,

Once I want to use sparse fields in URL eg.:

/api/something/?fields[bar]=somefield

The SparseFieldsetsMixin is checking for the key as substring:

key for key in request.query_params if sparse_fieldset_query_param in key

That causes the situation where not only 'fields[bar]' matches the if case but also prefixes:

/api/something/?someotherchars_fields[bar]=somefield

or

/api/something/?foooooooofields[bar]=somefield

Such behavior can cause some unexpected situations once for instance other mixin will use 'fields' key in some way to perform other operations on the same endpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions