From 1f6e0ecdc891a55d9e47da1bbf2350cc520eb755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Fri, 26 Nov 2021 19:59:57 +0100 Subject: [PATCH] Check for application/pdf as a substring and not as a full string for Content-Type and metadata in order to determine downloaded file type --- src/libgourou.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libgourou.cpp b/src/libgourou.cpp index bbbe447..b0c9de7 100644 --- a/src/libgourou.cpp +++ b/src/libgourou.cpp @@ -599,9 +599,13 @@ namespace gourou std::string rightsStr = item->getRights(); - if (headers.count("Content-Type") && headers["Content-Type"] == "application/pdf") + if (item->getMetadata("format").find("application/pdf") != std::string::npos) res = PDF; + if (headers.count("Content-Type") && + headers["Content-Type"].find("application/pdf") != std::string::npos) + res = PDF; + if (res == EPUB) { void* handler = client->zipOpen(path);