xlcnd / isbnlib

python library to validate, clean, transform and get metadata of ISBN strings (for devs).
Other
229 stars 30 forks source link

`mask` returns invalid result for ISBN with 0 idx #143

Open mgradalska opened 5 months ago

mgradalska commented 5 months ago

When I'm trying to mask 9786129999999 ISBN

mask('9786129999999')

it results in string with doubled separator:

'978-612--999999-9'

It doesn't look correct to me. I think the culprit here is that in this part of code https://github.com/xlcnd/isbnlib/blob/ddc62f2b77214205a7413b5d049c2a008c5271d4/isbnlib/_msk.py#L62 the second entry in the list is ib[6:6] (since idx is 0) and it returns an empty string.