DavBfr / dart_barcode

Barcode generation library
https://pub.dev/packages/barcode
Apache License 2.0
134 stars 39 forks source link

Fix invalid UPC-E in some cases #66

Closed shinbin closed 9 months ago

shinbin commented 9 months ago

Hi, DavBfr: I found an issue in UPC-E barcode and fixed it.

One of the cases had a UPC-E input value of "100802" or "01008029". The barcode content I expect to be displayed is "01008029" , as shown in the 1st picture, but it displays '01020089' and cannot be read by the barcode scanner , as shown in the 2nd picture. There are also errors in other input values, such as 107444,100902,100965,555555,1.. etc.

The issue comes from upcaToUpce() , whose RegExp cannot split groups accurately. Please help to check and merge my fixed version.

Thanks.

OK, Test site : https://www.online-barcode.com/barcode-generator or https://barcodeqrcode.com/upc-e-generator/ upce_ok

NG, Test site : https://davbfr.github.io/dart_barcode/#/ upce_ng

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7197206) 84.08% compared to head (7d1edd1) 84.04%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #66 +/- ## ========================================== - Coverage 84.08% 84.04% -0.05% ========================================== Files 32 32 Lines 2300 2294 -6 ========================================== - Hits 1934 1928 -6 Misses 366 366 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

shinbin commented 9 months ago

@DavBfr If you have time, please check out the pull request. Thanks.