diff --git a/cps/db.py b/cps/db.py index 710c202f..f0295fe5 100644 --- a/cps/db.py +++ b/cps/db.py @@ -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) diff --git a/cps/editbooks.py b/cps/editbooks.py index a0ddb050..5a15740c 100755 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -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 diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 62ba5c4e..7a1b3376 100755 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -164,7 +164,7 @@

{% for identifier in entry.identifiers %} - {{ identifier.format_type() }} {% endfor %}