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

fix: support /api/v0/products (with a s) #8087

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/ProductOpener/Routing.pm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ sub analyze_request ($request_ref) {

$request_ref->{api_action} = $components[2];

# Also support "products" in order not to break apps that were using it
if ($request_ref->{api_action} eq 'products') {
$request_ref->{api_action} = 'product';
}

# If the api_action is different than "search", check if it is the local path for "product"
# so that urls like https://fr.openfoodfacts.org/api/v3/produit/4324232423 work (produit instead of product)
# this is so that we can quickly add /api/v3/ to get the API
Expand Down