{"action":"opened","issue":{"url":"https://api.github.com/repos/openfoodfoundation/openfoodnetwork/issues/2836","repository_url":"https://api.github.com/repos/openfoodfoundation/openfoodnetwork","labels_url":"https://api.github.com/repos/openfoodfoundation/openfoodnetwork/issues/2836/labels{/name}","comments_url":"https://api.github.com/repos/openfoodfoundation/openfoodnetwork/issues/2836/comments","events_url":"https://api.github.com/repos/openfoodfoundation/openfoodnetwork/issues/2836/events","html_url":"https://github.com/openfoodfoundation/openfoodnetwork/issues/2836","id":367638040,"node_id":"MDU6SXNzdWUzNjc2MzgwNDA=","number":2836,"title":"Importing products with special characters fails","user":{"login":"mkllnk","id":3524483,"node_id":"MDQ6VXNlcjM1MjQ0ODM=","avatar_url":"https://avatars0.githubusercontent.com/u/3524483?v=4","gravatar_id":"","url":"https://api.github.com/users/mkllnk","html_url":"https://github.com/mkllnk","followers_url":"https://api.github.com/users/mkllnk/followers","following_url":"https://api.github.com/users/mkllnk/following{/other_user}","gists_url":"https://api.github.com/users/mkllnk/gists{/gist_id}","starred_url":"https://api.github.com/users/mkllnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkllnk/subscriptions","organizations_url":"https://api.github.com/users/mkllnk/orgs","repos_url":"https://api.github.com/users/mkllnk/repos","events_url":"https://api.github.com/users/mkllnk/events{/privacy}","received_events_url":"https://api.github.com/users/mkllnk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-08T04:48:13Z","updated_at":"2018-10-08T04:48:13Z","closed_at":null,"author_association":"MEMBER","body":"<!-- Provide a general summary of the issue in the Title above.\r\n\r\nIf your issue is not a bug, please use the Feature template instead:\r\nhttps://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-template\r\n\r\n-->\r\n## Description\r\n<!-- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->\r\n\r\nThe product import expects CSV files in UTF-8 character encoding. If the uploaded file is in a different encoding and contains characters like German umlauts, the application crashes (500 server error).\r\n\r\n## Expected Behavior\r\n<!-- Tell us what should happen -->\r\n\r\nUploading an invalid file results in a validation error being displayed.\r\n\r\n## Actual Behavior\r\n<!-- Tell us what happens instead -->\r\n\r\nThe generic snail page is displayed. The log contains:\r\n```\r\nArgumentError (invalid byte sequence in UTF-8):\r\n  app/models/product_import/product_importer.rb:223:in `rows'\r\n  app/models/product_import/product_importer.rb:245:in `build_entries'\r\n  app/models/product_import/product_importer.rb:180:in `init_product_importer'\r\n  app/models/product_import/product_importer.rb:38:in `initialize'\r\n  app/controllers/admin/product_import_controller.rb:15:in `new'\r\n  app/controllers/admin/product_import_controller.rb:15:in `import'\r\n```\r\n\r\n## Steps to Reproduce\r\n<!-- Provide an unambiguous set of steps to reproduce this bug -->\r\n<!-- Include code to reproduce if relevant -->\r\n\r\n1. Go to the product import, e.g. https://openfoodnetwork.de/admin/product_import\r\n2. Select a file containing special characters in a local encoding. \r\n[KL test 181005 3.txt](https://github.com/openfoodfoundation/openfoodnetwork/files/2454719/KL.test.181005.3.txt) (rename to `.csv`)\r\n3. Click \"Upload\"\r\n\r\n\r\n## Context\r\n<!-- How has this bug affected you? What were you trying to accomplish? -->\r\n\r\nKirsten was testing the product import for the first German enterprises with a test file. They are pulling the data from another database.\r\n\r\n## Severity\r\n<!-- Assign a label and explain the impact.\r\n\r\nbug-s1: a critical feature is broken: checkout, payments, signup, login\r\nbug-s2: a non-critical feature is broken, no workaround\r\nbug-s3: a feature is broken but there is a workaround\r\nbug-s4: it's annoying, but you can use it\r\nbug-s5: we can live with it, only a few users impacted\r\n\r\nhttps://github.com/openfoodfoundation/openfoodnetwork/wiki/Bug-severity\r\n-->\r\n\r\ns3 as product import is not officially released and it affects only some users. The workaround is to use UTF8-encoded CSV files.\r\n\r\n## Your Environment\r\n<!-- Include relevant details about the environment you experienced the bug in -->\r\n\r\n* Version used: 58a99a7f8993cf609d930a68d82b382fccce8ea4\r\n\r\n## Possible Fix\r\n<!-- Not obligatory, but suggest a fix or reason for the bug -->\r\n\r\nRescue the `ArgumentError` and display a helpful message.\r\n"}}
{"actor":{"display_login":"mkllnk"}}