]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix issue #2296: epub export with `+` in the title. 2297/head
authorÉtienne Gilli <etienne.gilli@gmail.com>
Sun, 18 Sep 2016 12:43:54 +0000 (14:43 +0200)
committerÉtienne Gilli <etienne.gilli@gmail.com>
Sun, 18 Sep 2016 12:43:54 +0000 (14:43 +0200)
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(