Skip to content

Commit bcc46c5

Browse files
committed
enclosure_tags: strip HTML tags from values used as MP3 tags.
1 parent 0011dcf commit bcc46c5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Version 3.19
1111

1212
Unreleased
1313

14+
* :mod:`~reader._plugins.enclosure_tags` plugin:
15+
strip HTML tags from values used as MP3 tags
16+
(for example, ``<b>`` tags used to highlight search result matches).
17+
1418

1519
Version 3.18
1620
------------

src/reader/_plugins/enclosure_tags.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from flask import Response
3939
from flask import stream_with_context
4040
from flask import url_for
41+
from jinja2.filters import do_striptags as striptags
4142

4243

4344
blueprint = Blueprint('enclosure_tags', __name__)
@@ -146,12 +147,13 @@ def enclosure_tags_filter(enclosure, entry, feed_tags):
146147

147148
args = {'url': enclosure.href, 'filename': filename}
148149
if entry.title:
149-
args['title'] = entry.title
150+
args['title'] = striptags(entry.title)
150151
if album := (entry.feed.user_title or entry.feed.title):
152+
album = striptags(album)
151153
args['album'] = album
152154
args['artist'] = album
153155
elif artist := (entry.author or entry.feed.author):
154-
args['artist'] = artist
156+
args['artist'] = striptags(artist)
155157

156158
for tag in feed_tags:
157159
if 'podcast' in tag.lower():

0 commit comments

Comments
 (0)