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

The 'products' endpoint doesn't fix invalid barcodes #6024

Closed
blazern opened this issue Oct 26, 2021 · 1 comment · Fixed by #6026
Closed

The 'products' endpoint doesn't fix invalid barcodes #6024

blazern opened this issue Oct 26, 2021 · 1 comment · Fixed by #6026
Assignees
Labels
🐛 bug This is a bug, not a feature request.

Comments

@blazern
Copy link
Contributor

blazern commented Oct 26, 2021

Describe the bug

There's a milk packaging with barcode 025293001220 on it.
The barcode is invalid, because it lacks the leading 0. If we add it the barcode becomes valid - 0025293001220.

The product endpoint is aware of it and when the invalid barcode is requested it automatically adds the leading zero, making the product found: https://ru.openfoodfacts.org/api/v0/product/025293001220.json
But the products (multiple barcodes) endpoint seems to be not aware of it and it gives an empty list when the invalid barcode is requested: https://world.openfoodfacts.org/products/025293001220.json

I can't come up with workarounds for the problem since the requester can't know how many leading zeroes to append to the barcode - while 025293001220 is invalid, both 0025293001220 and 00025293001220 are valid (2 and 3 leading zeroes).

To Reproduce

Request https://ru.openfoodfacts.org/api/v0/product/025293001220.json
Then https://world.openfoodfacts.org/products/025293001220.json

Expected behavior

products is expected to validate barcodes in the same way as product.

Screenshots

No response

Additional context

No response

Type of device

REST-API

Browser version

No response

Number of products impacted

No response

Time per product

No response

@blazern blazern added the 🐛 bug This is a bug, not a feature request. label Oct 26, 2021
@stephanegigandet stephanegigandet self-assigned this Oct 26, 2021
hangy pushed a commit to hangy/openfoodfacts-server that referenced this issue Oct 27, 2021
…odfacts#6026) (#1234)

Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>
@blazern
Copy link
Contributor Author

blazern commented Oct 27, 2021

Thank you Stephane! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug This is a bug, not a feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants