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

Use proper named arguments to load a product #4480

Merged
merged 1 commit into from Feb 15, 2022
Merged

Use proper named arguments to load a product #4480

merged 1 commit into from Feb 15, 2022

Conversation

R4md4c
Copy link
Contributor

@R4md4c R4md4c commented Feb 15, 2022

Description

The issue is reproducible when deep-linking from the website to open a product with a barcode.

Open the website, type a barcode like 20518868, pick 'Open Food Facts' to open the product, the crash happens.

The fix was quite simple, as the userAgent was sent in the position of the fields query param instead of being userAgent, so the product fields weren't being retrieved correctly and the request ended becoming https://ssl-api.openfoodfacts.org/api/v0/product/20518868?fields=Scan. So I used named arguments to make sure that arguments positioning were correct.

Related issues

Fixes #4222

@sonarcloud
Copy link

sonarcloud bot commented Feb 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@teolemon teolemon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful @R4md4c 😍
Given the impact, I'm going to FasTrack the deployment

@teolemon teolemon merged commit 5e4f50a into openfoodfacts:develop Feb 15, 2022
@R4md4c R4md4c deleted the fix-product-state-4222 branch February 15, 2022 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants