Skip to content

Commit

Permalink
Merge pull request #804 from kiwix/illustration_url_uses_the_book_uuid
Browse files Browse the repository at this point in the history
Illustration URL uses the book UUID
  • Loading branch information
mgautierfr committed Aug 4, 2022
2 parents dd90ca1 + 111aab0 commit 8e6d893
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/server/internalServer_catalog_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ std::unique_ptr<Response> InternalServer::handle_catalog_v2_languages(const Requ
std::unique_ptr<Response> InternalServer::handle_catalog_v2_illustration(const RequestContext& request)
{
try {
const auto bookName = request.get_url_part(3);
const auto bookId = mp_nameMapper->getIdForName(bookName);
const auto bookId = request.get_url_part(3);
auto book = mp_library->getBookByIdThreadSafe(bookId);
auto size = request.get_argument<unsigned int>("size");
auto illustration = book.getIllustration(size);
Expand Down
2 changes: 1 addition & 1 deletion static/templates/catalog_v2_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<articleCount>{{article_count}}</articleCount>
<mediaCount>{{media_count}}</mediaCount>
{{#icons}}<link rel="http://opds-spec.org/image/thumbnail"
href="{{root}}/catalog/v2/illustration/{{{content_id}}}/?size={{icon_size}}"
href="{{root}}/catalog/v2/illustration/{{{id}}}/?size={{icon_size}}"
type="{{icon_mimetype}};width={{icon_size}};height={{icon_size}};scale=1"/>
{{/icons}}<link type="text/html" href="{{root}}/{{{content_id}}}" />
<author>
Expand Down
2 changes: 1 addition & 1 deletion test/library_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ std::string maskVariableOPDSFeedData(std::string s)
" <articleCount>284</articleCount>\n" \
" <mediaCount>2</mediaCount>\n" \
" <link rel=\"http://opds-spec.org/image/thumbnail\"\n" \
" href=\"/ROOT/catalog/v2/illustration/zimfile/?size=48\"\n" \
" href=\"/ROOT/catalog/v2/illustration/raycharles/?size=48\"\n" \
" type=\"image/png;width=48;height=48;scale=1\"/>\n" \
" <link type=\"text/html\" href=\"/ROOT/zimfile\" />\n" \
" <author>\n" \
Expand Down
5 changes: 3 additions & 2 deletions test/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ResourceCollection resources200Uncompressible{
{ WITH_ETAG, "/ROOT/raw/zimfile/meta/Creator" },
{ WITH_ETAG, "/ROOT/raw/zimfile/meta/Publisher" },

{ NO_ETAG, "/ROOT/catalog/v2/illustration/zimfile?size=48" },
{ NO_ETAG, "/ROOT/catalog/v2/illustration/6f1d19d0-633f-087b-fb55-7ac324ff9baf?size=48" },

{ WITH_ETAG, "/ROOT/zimfile/I/m/Ray_Charles_classic_piano_pose.jpg" },

Expand Down Expand Up @@ -253,7 +253,8 @@ const char* urls404[] = {
"/ROOT/catalog",
"/ROOT/catalog/non-existent-item",
"/ROOT/catalogBLABLABLA/root.xml",
"/ROOT/catalog/v2/illustration/zimfile?size=96",
"/ROOT/catalog/v2/illustration/zimfile?size=48",
"/ROOT/catalog/v2/illustration/6f1d19d0-633f-087b-fb55-7ac324ff9baf?size=96",
"/ROOT/meta",
"/ROOT/meta?content=zimfile",
"/ROOT/meta?content=zimfile&name=non-existent-item",
Expand Down

0 comments on commit 8e6d893

Please sign in to comment.