mirror of
https://github.com/JonathanHerrewijnen/calibre-web.git
synced 2024-11-11 05:33:57 +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,10 +122,13 @@ 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:
|
||||||
|
try:
|
||||||
if int(series_index) - series_index == 0:
|
if int(series_index) - series_index == 0:
|
||||||
return int(series_index)
|
return int(series_index)
|
||||||
else:
|
else:
|
||||||
return series_index
|
return series_index
|
||||||
|
except ValueError:
|
||||||
|
return series_index
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@jinjia.app_template_filter('uuidfilter')
|
@jinjia.app_template_filter('uuidfilter')
|
||||||
|
Loading…
Reference in New Issue
Block a user