openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
658 stars 387 forks source link

PATCH requests don't accept non-ASCII passwords #9503

Open monsieurtanuki opened 11 months ago

monsieurtanuki commented 11 months ago

I've changed my password in order to include a £ and have witnessed no problem in most cases:

BUT: I've encountered a problem with the new packagings feature, which is the only case to be saved with a PATCH request (temporarySaveProductV3, /api/v3/product/$barcode).

Any idea why the PATCH request would not accept a password with a £, whereas the /cgi/product_jqm2.pl POST works correctly?

patch param value
uri https://world.openfoodfacts.org/api/v3/product/9780000000001
header {Accept: application/json, User-Agent: - Smoothie - OpenFoodFacts - 0.0.0+734 - android+sdk_gphone64_x86_64-userdebug 12 SE1A.220203.002.A1 8151367 dev-keys - https://world.openfoodfacts.org/ - , From: monsieurtanuki}
body {"user_id":"monsieurtanuki","password":"something with a £","product":{"packagings":[{"shape":{"lc_name":"Bouteille"},"material":{"lc_name":"Verre"},"recycling":{"lc_name":"Recycler"},"number_of_units":1}]},"lc":"fr","tags_lc":"fr","cc":"fr","app_name":"Smoothie - OpenFoodFacts","app_version":"0.0.0+734","app_uuid":"6bd6aeef88464d03","app_platform":"android+sdk_gphone64_x86_64-userdebug 12 SE1A.220203.002.A1 8151367 dev-keys","comment":""}

Originally posted by @monsieurtanuki in https://github.com/openfoodfacts/smooth-app/issues/4663#issuecomment-1835931976

alexgarel commented 11 months ago

@monsieurtanuki we have to give a look at how we parse the parameter.

We should also add an integration test for this !