1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-24 10:37:23 +00:00

Update edit identifiers

This commit is contained in:
Ozzie Isaacs 2023-07-29 11:10:54 +02:00
parent cce538d5a7
commit df74fdb4d1
3 changed files with 8 additions and 2 deletions

View File

@ -173,6 +173,9 @@ class Identifiers(Base):
return "https://www.databazeknih.cz/knihy/{0}".format(self.val)
elif self.val.lower().startswith("javascript:"):
return quote(self.val)
elif self.val.lower().startswith("data:"):
link , __, __ = str.partition(self.val, ",")
return link
else:
return "{0}".format(self.val)

View File

@ -27,9 +27,10 @@ from shutil import copyfile
from uuid import uuid4
from markupsafe import escape # dependency of flask
from functools import wraps
import re
try:
from lxml.html.clean import clean_html
from lxml.html.clean import clean_html, Cleaner
except ImportError:
clean_html = None
@ -599,6 +600,8 @@ def identifier_list(to_save, book):
val_key = id_val_prefix + type_key[len(id_type_prefix):]
if val_key not in to_save.keys():
continue
if to_save[val_key].startswith("data:"):
to_save[val_key], __, __ = str.partition(to_save[val_key], ",")
result.append(db.Identifiers(to_save[val_key], type_value, book.id))
return result

View File

@ -164,7 +164,7 @@
<p>
<span class="glyphicon glyphicon-link"></span>
{% for identifier in entry.identifiers %}
<a href="{{ identifier }}" target="_blank" class="btn btn-xs btn-success"
<a href="{{ identifier|escape }}" target="_blank" class="btn btn-xs btn-success"
role="button">{{ identifier.format_type() }}</a>
{% endfor %}
</p>