Revert "Fix browser caching problem on change cover"

This reverts commit b9536812f4.
This commit is contained in:
Ozzieisaacs 2020-11-22 10:06:54 +01:00
parent 747b25046a
commit ecea7e7493
2 changed files with 8 additions and 11 deletions

View File

@ -284,7 +284,7 @@ def delete_book(book_id, book_format, jsonResponse):
return redirect(url_for('web.index'))
def render_edit_book(book_id, cover_edited):
def render_edit_book(book_id):
calibre_db.update_title_sort(config)
cc = calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()
book = calibre_db.get_filtered_book(book_id)
@ -307,7 +307,7 @@ def render_edit_book(book_id, cover_edited):
kepub_possible=None
if config.config_converterpath:
for file in book.data:
if file.format.lower() in constants.EXTENSIONS_CONVERT_FROM:
if file.format.lower() in constants.EXTENSIONS_CONVERT:
valid_source_formats.append(file.format.lower())
if config.config_kepubifypath and 'epub' in [file.format.lower() for file in book.data]:
kepub_possible = True
@ -316,7 +316,7 @@ def render_edit_book(book_id, cover_edited):
# Determine what formats don't already exist
if config.config_converterpath:
allowed_conversion_formats = constants.EXTENSIONS_CONVERT_TO[:]
allowed_conversion_formats = constants.EXTENSIONS_CONVERT[:]
for file in book.data:
if file.format.lower() in allowed_conversion_formats:
allowed_conversion_formats.remove(file.format.lower())
@ -325,7 +325,7 @@ def render_edit_book(book_id, cover_edited):
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
title=_(u"edit metadata"), page="editbook",
conversion_formats=allowed_conversion_formats,
config=config, cover_edit=cover_edited,
config=config,
source_formats=valid_source_formats)
@ -582,10 +582,9 @@ def upload_cover(request, book):
@edit_required
def edit_book(book_id):
modif_date = False
cover_edited = 0
# Show form
if request.method != 'POST':
return render_edit_book(book_id, cover_edited)
return render_edit_book(book_id)
# create the function for sorting...
calibre_db.update_title_sort(config)
@ -600,7 +599,6 @@ def edit_book(book_id):
if upload_cover(request, book) is True:
book.has_cover = 1
modif_date = True
cover_edited = uuid4()
try:
to_save = request.form.to_dict()
merge_metadata(to_save, meta)
@ -661,7 +659,6 @@ def edit_book(book_id):
if result is True:
book.has_cover = 1
modif_date = True
cover_edited = uuid4()
else:
flash(error, category="error")
@ -713,11 +710,11 @@ def edit_book(book_id):
return redirect(url_for('web.show_book', book_id=book.id))
else:
flash(_("Metadata successfully updated"), category="success")
return render_edit_book(book_id, cover_edited)
return render_edit_book(book_id)
else:
calibre_db.session.rollback()
flash(error, category="error")
return render_edit_book(book_id, cover_edited)
return render_edit_book(book_id)
except Exception as e:
log.exception(e)
calibre_db.session.rollback()

View File

@ -3,7 +3,7 @@
{% if book %}
<div class="col-sm-3 col-lg-3 col-xs-12">
<div class="cover">
<img src="{{ url_for('web.get_cover', book_id=book.id, edit=cover_edit) }}" alt="{{ book.title }}"/>
<img src="{{ url_for('web.get_cover', book_id=book.id) }}" alt="{{ book.title }}"/>
</div>
{% if g.user.role_delete_books() %}
<div class="text-center">