Fix: xml error with opds in moon reader (#1396)
This commit is contained in:
+10
-10
@@ -42,20 +42,20 @@ public class OpdsFeedService {
|
|||||||
<title>All Books</title>
|
<title>All Books</title>
|
||||||
<id>urn:booklore:catalog:all</id>
|
<id>urn:booklore:catalog:all</id>
|
||||||
<updated>%s</updated>
|
<updated>%s</updated>
|
||||||
<link rel="subsection" href="/api/v1/opds/catalog?page=1&size=%d" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
<link rel="subsection" href="%s" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
||||||
<content type="text">Browse all available books</content>
|
<content type="text">Browse all available books</content>
|
||||||
</entry>
|
</entry>
|
||||||
""".formatted(now(), DEFAULT_PAGE_SIZE));
|
""".formatted(now(), escapeXml("/api/v1/opds/catalog?page=1&size=" + DEFAULT_PAGE_SIZE)));
|
||||||
|
|
||||||
feed.append("""
|
feed.append("""
|
||||||
<entry>
|
<entry>
|
||||||
<title>Recently Added</title>
|
<title>Recently Added</title>
|
||||||
<id>urn:booklore:catalog:recent</id>
|
<id>urn:booklore:catalog:recent</id>
|
||||||
<updated>%s</updated>
|
<updated>%s</updated>
|
||||||
<link rel="subsection" href="/api/v1/opds/recent?page=1&size=%d" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
<link rel="subsection" href="%s" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
||||||
<content type="text">Recently added books</content>
|
<content type="text">Recently added books</content>
|
||||||
</entry>
|
</entry>
|
||||||
""".formatted(now(), DEFAULT_PAGE_SIZE));
|
""".formatted(now(), escapeXml("/api/v1/opds/recent?page=1&size=" + DEFAULT_PAGE_SIZE)));
|
||||||
|
|
||||||
feed.append("""
|
feed.append("""
|
||||||
<entry>
|
<entry>
|
||||||
@@ -112,14 +112,14 @@ public class OpdsFeedService {
|
|||||||
<title>%s</title>
|
<title>%s</title>
|
||||||
<id>urn:booklore:library:%d</id>
|
<id>urn:booklore:library:%d</id>
|
||||||
<updated>%s</updated>
|
<updated>%s</updated>
|
||||||
<link rel="subsection" href="/api/v1/opds/catalog?libraryId=%d" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
<link rel="subsection" href="%s" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
||||||
<content type="text">%s</content>
|
<content type="text">%s</content>
|
||||||
</entry>
|
</entry>
|
||||||
""".formatted(
|
""".formatted(
|
||||||
escapeXml(library.getName()),
|
escapeXml(library.getName()),
|
||||||
library.getId(),
|
library.getId(),
|
||||||
now(),
|
now(),
|
||||||
library.getId(),
|
escapeXml("/api/v1/opds/catalog?libraryId=" + library.getId()),
|
||||||
escapeXml(library.getName() != null ? library.getName() : "Library collection")
|
escapeXml(library.getName() != null ? library.getName() : "Library collection")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -153,14 +153,14 @@ public class OpdsFeedService {
|
|||||||
<title>%s</title>
|
<title>%s</title>
|
||||||
<id>urn:booklore:shelf:%d</id>
|
<id>urn:booklore:shelf:%d</id>
|
||||||
<updated>%s</updated>
|
<updated>%s</updated>
|
||||||
<link rel="subsection" href="/api/v1/opds/catalog?shelfId=%d" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
<link rel="subsection" href="%s" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
||||||
<content type="text">Personal shelf collection</content>
|
<content type="text">Personal shelf collection</content>
|
||||||
</entry>
|
</entry>
|
||||||
""".formatted(
|
""".formatted(
|
||||||
escapeXml(shelf.getName()),
|
escapeXml(shelf.getName()),
|
||||||
shelf.getId(),
|
shelf.getId(),
|
||||||
now(),
|
now(),
|
||||||
shelf.getId()
|
escapeXml("/api/v1/opds/catalog?shelfId=" + shelf.getId())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,7 +202,7 @@ public class OpdsFeedService {
|
|||||||
booksPage.getTotalElements(),
|
booksPage.getTotalElements(),
|
||||||
((page - 1) * size) + 1,
|
((page - 1) * size) + 1,
|
||||||
size,
|
size,
|
||||||
buildCurrentUrl(request, page, size)
|
escapeXml(buildCurrentUrl(request, page, size))
|
||||||
));
|
));
|
||||||
|
|
||||||
appendPaginationLinks(feed, request, page, booksPage.getTotalPages(), size);
|
appendPaginationLinks(feed, request, page, booksPage.getTotalPages(), size);
|
||||||
@@ -232,7 +232,7 @@ public class OpdsFeedService {
|
|||||||
<link rel="self" href="%s" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
<link rel="self" href="%s" type="application/atom+xml;profile=opds-catalog;kind=acquisition"/>
|
||||||
<link rel="start" href="/api/v1/opds" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
|
<link rel="start" href="/api/v1/opds" type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
|
||||||
<link rel="search" type="application/opensearchdescription+xml" title="Search" href="/api/v1/opds/search.opds"/>
|
<link rel="search" type="application/opensearchdescription+xml" title="Search" href="/api/v1/opds/search.opds"/>
|
||||||
""".formatted(now(), booksPage.getTotalElements(), ((page - 1) * size) + 1, size, buildCurrentUrl(request, page, size)));
|
""".formatted(now(), booksPage.getTotalElements(), ((page - 1) * size) + 1, size, escapeXml(buildCurrentUrl(request, page, size))));
|
||||||
|
|
||||||
appendPaginationLinks(feed, request, page, booksPage.getTotalPages(), size);
|
appendPaginationLinks(feed, request, page, booksPage.getTotalPages(), size);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user