web/opds: escape titles

Moon Reader errored out in XML parsing because and an amperstand in one
of my book titles wasn't esacped. Ooops!

Signed-off-by: Brandon Philips <brandon@ifup.org>
This commit is contained in:
Brandon Philips 2026-02-10 13:42:51 -08:00
parent 1c8d37df41
commit 70ad121869
2 changed files with 5 additions and 5 deletions

View file

@ -5,7 +5,7 @@
type="application/opensearchdescription+xml"/> type="application/opensearchdescription+xml"/>
{%- for d in dirs %} {%- for d in dirs %}
<entry> <entry>
<title>{{ d.name }}</title> <title>{{ d.name | e }}</title>
<link rel="subsection" <link rel="subsection"
href="{{ d.href | e }}" href="{{ d.href | e }}"
type="application/atom+xml;profile=opds-catalog"/> type="application/atom+xml;profile=opds-catalog"/>
@ -14,7 +14,7 @@
{%- endfor %} {%- endfor %}
{%- for f in files %} {%- for f in files %}
<entry> <entry>
<title>{{ f.name }}</title> <title>{{ f.name | e }}</title>
<updated>{{ f.iso8601 }}</updated> <updated>{{ f.iso8601 }}</updated>
<link rel="http://opds-spec.org/acquisition" <link rel="http://opds-spec.org/acquisition"
href="{{ f.href | e }}" href="{{ f.href | e }}"

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>C {{ longname | truncate(14) }}</ShortName> <ShortName>C {{ longname | truncate(14) | e }}</ShortName>
<Description>Copyparty {{ longname }}</Description> <Description>Copyparty {{ longname | e }}</Description>
<Url type="application/atom+xml;profile=opds-catalog" template="{{ search_url }}?opds&amp;q={searchTerms}"/> <Url type="application/atom+xml;profile=opds-catalog" template="{{ search_url }}?opds&amp;q={searchTerms}"/>
</OpenSearchDescription> </OpenSearchDescription>