]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Helper/EntriesExport.php
Fix issue #2296: epub export with `+` in the title.
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / EntriesExport.php
index 0cf835b48be00ee1a35566f461fd570f47e2e37e..e91007e1ba7eeccb6781e601a770ebfcb182bd5d 100644 (file)
@@ -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(