mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Escape HTML entities in comments
This commit is contained in:
parent
8cbaa3a9e2
commit
a81ff78c0a
@ -176,7 +176,7 @@ def get_metadata_(src, encoding=None):
|
||||
mi = Metadata(title, string_to_authors(authors))
|
||||
|
||||
# Single-value text fields
|
||||
for field in ('publisher', 'isbn', 'comments'):
|
||||
for field in ('publisher', 'isbn'):
|
||||
val = get(field)
|
||||
if val:
|
||||
setattr(mi, field, val)
|
||||
@ -187,6 +187,12 @@ def get_metadata_(src, encoding=None):
|
||||
if val:
|
||||
setattr(mi, field, val)
|
||||
|
||||
# HTML fields
|
||||
for field in ('comments',):
|
||||
val = get(field)
|
||||
if val:
|
||||
setattr(mi, field, val.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace("'", '''))
|
||||
|
||||
# Date fields
|
||||
for field in ('pubdate', 'timestamp'):
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user