mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 17:40:31 +00:00
Fix #1992 handle invalid numbers of books seriesindex
This commit is contained in:
parent
c85cfa90a4
commit
bd4fde9e63
@ -439,6 +439,9 @@ def edit_book_series_index(series_index, book):
|
|||||||
# Add default series_index to book
|
# Add default series_index to book
|
||||||
modif_date = False
|
modif_date = False
|
||||||
series_index = series_index or '1'
|
series_index = series_index or '1'
|
||||||
|
if not series_index.replace('.', '', 1).isdigit():
|
||||||
|
flash(_("%(seriesindex)s is not a valid number, skipping", seriesindex=series_index), category="warning")
|
||||||
|
return False
|
||||||
if book.series_index != series_index:
|
if book.series_index != series_index:
|
||||||
book.series_index = series_index
|
book.series_index = series_index
|
||||||
modif_date = True
|
modif_date = True
|
||||||
|
@ -122,9 +122,12 @@ def formatfloat(value, decimals=1):
|
|||||||
@jinjia.app_template_filter('formatseriesindex')
|
@jinjia.app_template_filter('formatseriesindex')
|
||||||
def formatseriesindex_filter(series_index):
|
def formatseriesindex_filter(series_index):
|
||||||
if series_index:
|
if series_index:
|
||||||
if int(series_index) - series_index == 0:
|
try:
|
||||||
return int(series_index)
|
if int(series_index) - series_index == 0:
|
||||||
else:
|
return int(series_index)
|
||||||
|
else:
|
||||||
|
return series_index
|
||||||
|
except ValueError:
|
||||||
return series_index
|
return series_index
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user