From: Étienne Gilli Date: Sun, 18 Sep 2016 12:43:54 +0000 (+0200) Subject: Fix issue #2296: epub export with `+` in the title. X-Git-Tag: 2.1.0~33^2^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=45d94a98f78320fd993c4d5bce925c66d8e38346;p=github%2Fwallabag%2Fwallabag.git Fix issue #2296: epub export with `+` in the title. --- diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 0cf835b4..e91007e1 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -163,8 +163,12 @@ class EntriesExport $book->setSubject($tag['value']); } + // the reader in Kobo Devices doesn't likes special caracters + // in filenames, we limit to A-z/0-9 + $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle()); + $chapter = $content_start.$entry->getContent().$bookEnd; - $book->addChapter($entry->getTitle(), htmlspecialchars($entry->getTitle()).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD); + $book->addChapter($entry->getTitle(), htmlspecialchars($filename).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD); } return Response::create(