mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
ISBN checking now correctly flags ISBNs with all same digits as invalid
This commit is contained in:
parent
571f50be43
commit
75a43d9c1a
@ -274,6 +274,9 @@ def check_isbn(isbn):
|
|||||||
if not isbn:
|
if not isbn:
|
||||||
return None
|
return None
|
||||||
isbn = re.sub(r'[^0-9X]', '', isbn.upper())
|
isbn = re.sub(r'[^0-9X]', '', isbn.upper())
|
||||||
|
all_same = re.match(r'(\d)\1{9,12}$', isbn)
|
||||||
|
if all_same is not None:
|
||||||
|
return None
|
||||||
if len(isbn) == 10:
|
if len(isbn) == 10:
|
||||||
return check_isbn10(isbn)
|
return check_isbn10(isbn)
|
||||||
if len(isbn) == 13:
|
if len(isbn) == 13:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user