From 4af3f326aa364e5fc8adef9a17b5e96447416f9b Mon Sep 17 00:00:00 2001 From: mikespub Date: Thu, 15 Feb 2024 16:58:21 +0100 Subject: [PATCH] provide kepub without update of opf properties - see issue #71 --- fetch.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fetch.php b/fetch.php index 5e10ca8bd..748976539 100644 --- a/fetch.php +++ b/fetch.php @@ -78,6 +78,7 @@ // absolute path for single DB in PHP app here - cfr. internal dir for X-Accel-Redirect with Nginx $file = $book->getFilePath($type, $idData); if (!$viewOnly && $type == 'epub' && Config::get('update_epub-metadata')) { + // update epub metadata + provide kepub if needed (with update of opf properties for cover-image in EPub) if (Config::get('provide_kepub') == '1' && preg_match('/Kobo/', $request->agent())) { $book->updateForKepub = true; } @@ -86,6 +87,9 @@ } if ($viewOnly) { header('Content-Disposition: inline'); +} elseif (Config::get('provide_kepub') == '1' && preg_match('/Kobo/', $request->agent())) { + // provide kepub if needed (without update of opf properties for cover-image in Epub) + header('Content-Disposition: attachment; filename="' . basename($data->getUpdatedFilenameKepub()) . '"'); } else { header('Content-Disposition: attachment; filename="' . basename($file) . '"'); }