self-core icon indicating copy to clipboard operation
self-core copied to clipboard

CachedResource: Uniform URI keys.

Open criske opened this issue 4 years ago • 6 comments

Having two URI's

/foo/bar?a=100&b=true and /foo/bar?b=true&a=100

Eventhough these URIs have query parameters in different order, they are pointing to the same Resource. And this will lead to duplicate entries in JsonStorage - will be treated as different primary key.

Proposal: order URI query parameters by 'name' in alphabetical oder before storing CachedResource into JsonStorage.

Ex: /foo/bar?b=true&a=100 will be /foo/bar?a=100&b=true before storing.

criske avatar Jun 10 '21 17:06 criske

@criske thank you for reporting this. I'll assign someone to take care of it soon.

zoeself avatar Jun 10 '21 17:06 zoeself

@amihaiemil now that I think about it, I think this should be done by JsonStorage implementation - both before storing and getting:

For example if we query for Json#getResource(/foo/bar?b=true&a=100), it should order internally and then query for resource..

Edit -- or in JsonResources, just to keep the logic in self-core. :D

criske avatar Jun 10 '21 17:06 criske

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.

zoeself avatar Jun 10 '21 17:06 zoeself

@criske It's a valid issue, but as you said in Prod we will never face it. Github and GitLab URIs do not use query parameters at all (maybe just per_page). So I think it's virtually a useless fix: more complicated code for nothing : D

amihaiemil avatar Jun 15 '21 13:06 amihaiemil

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.

zoeself avatar Aug 27 '22 06:08 zoeself