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

Additional case handling for color parameter in search API #22692

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

chrstinalin
Copy link
Contributor

Fixes: mozilla/addons#15022

Description

Handles cases as follows --

  1. The empty color parameter is ignored.
  2. Otherwise, take the first 6 characters of the color parameter (after removing the #, if any). 3-character hex codes (ex. #aaa) still pass.
  3. Throw ValueError if the value is still unparseable as a hex code.

Testing

Directly use the search function for static themes, or to the API directly, ex.
http://olympia.test/api/v5/addons/search/?type=statictheme&color=336699aa

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

… alpha value of hex string, throw error if otherwise unparseable
Copy link

sentry-io bot commented Sep 20, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/olympia/search/filters.py

Function Unhandled Issue
get_es_query TypeError: hsl() takes 3 positional arguments but 4 were given /api/v5/...
Event Count: 5
get_es_query TypeError: hsl() missing 3 required positional arguments: 'r', 'g', and 'b' /...
Event Count: 1

Did you find this useful? React with a 👍 or 👎

@chrstinalin chrstinalin marked this pull request as draft September 20, 2024 19:27
@chrstinalin chrstinalin marked this pull request as ready for review September 20, 2024 21:24
@chrstinalin chrstinalin requested review from a team and diox and removed request for a team September 20, 2024 21:24
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.

[Bug]: Some values of the color parameter in search API trigger a 500
1 participant