Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use greedy regex #1126

Merged
merged 1 commit into from
Dec 9, 2024
Merged

Conversation

psilabs-dev
Copy link
Contributor

Closes #1122.

The sorting issue happens in the search API, which uses regex to get the sortingkey and passes it to ncmp. After logging arguments for ncmp I found that it's taking not only the value for a key-value tag, but it's also getting subsequent tags, i.e. the comma is being included, e.g.

tags = "date_uploaded:123,date_added:321,tag1,tag2" with sortkey "date_uploaded" can sometimes overreach and be "123,date_added:321" instead of "123" and resulting in incorrectly sorted search results.

Checking again, turns out this regex is greedy. The fix is to disable greediness.

@Difegue Difegue merged commit 1a0d721 into Difegue:dev Dec 9, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search API sorting logic bug
2 participants