diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php
index 7ca892394..9e9dbe49a 100644
--- a/src/Wallabag/CoreBundle/Controller/ExportController.php
+++ b/src/Wallabag/CoreBundle/Controller/ExportController.php
@@ -58,6 +58,7 @@ class ExportController extends Controller
$method = ucfirst($category);
$methodBuilder = 'getBuilderFor' . $method . 'ByUser';
$repository = $this->get('wallabag_core.entry_repository');
+ $title = $method;
if ('tag_entries' === $category) {
$tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag'));
@@ -66,6 +67,8 @@ class ExportController extends Controller
$this->getUser()->getId(),
$tag->getId()
);
+
+ $title = 'Tag ' . $tag->getLabel();
} else {
$entries = $repository
->$methodBuilder($this->getUser()->getId())
@@ -76,7 +79,7 @@ class ExportController extends Controller
try {
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entries)
- ->updateTitle($method)
+ ->updateTitle($title)
->updateAuthor($method)
->exportAs($format);
} catch (\InvalidArgumentException $e) {
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 6082f6b9c..64591687d 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -85,7 +85,7 @@ class EntriesExport
public function updateAuthor($method)
{
if ('entry' !== $method) {
- $this->author = $method . ' authors';
+ $this->author = 'Various authors';
return $this;
}
@@ -173,6 +173,8 @@ class EntriesExport
}
$entryIds = [];
+ $entryCount = \count($this->entries);
+ $i = 0;
/*
* Adding actual entries
@@ -180,35 +182,47 @@ class EntriesExport
// set tags as subjects
foreach ($this->entries as $entry) {
+ ++$i;
foreach ($entry->getTags() as $tag) {
$book->setSubject($tag->getLabel());
}
+ $filename = sha1($entry->getTitle());
- // 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());
+ $publishedBy = $entry->getPublishedBy();
+ $authors = $this->translator->trans('export.unknown');
+ if (!empty($publishedBy)) {
+ $authors = implode(',', $publishedBy);
+ }
- $titlepage = $content_start . '
' . $entry->getTitle() . '
' . $this->getExportInformation('PHPePub') . $bookEnd;
- $book->addChapter('Title', 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD);
+ $titlepage = $content_start .
+ '' . $entry->getTitle() . '
' .
+ '' .
+ '- ' . $this->translator->trans('entry.view.published_by') . '
- ' . $authors . '
' .
+ '- ' . $this->translator->trans('entry.metadata.reading_time') . '
- ' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '
' .
+ '- ' . $this->translator->trans('entry.metadata.added_on') . '
- ' . $entry->getCreatedAt()->format('Y-m-d') . '
' .
+ '- ' . $this->translator->trans('entry.metadata.address') . '
- ' . $entry->getUrl() . '
' .
+ '
' .
+ $bookEnd;
+ $book->addChapter("Entry {$i} of {$entryCount}", "{$filename}_cover.html", $titlepage, true, EPub::EXTERNAL_REF_ADD);
$chapter = $content_start . $entry->getContent() . $bookEnd;
- $book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
$entryIds[] = $entry->getId();
+ $book->addChapter($entry->getTitle(), "{$filename}.html", $chapter, true, EPub::EXTERNAL_REF_ADD);
}
+ $book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd);
+
// Could also be the ISBN number, prefered for published books, or a UUID.
$hash = sha1(sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds)));
$book->setIdentifier(sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI);
- $book->buildTOC();
-
return Response::create(
$book->getBook(),
200,
[
'Content-Description' => 'File Transfer',
'Content-type' => 'application/epub+zip',
- 'Content-Disposition' => 'attachment; filename="' . $this->title . '.epub"',
+ 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.epub"',
'Content-Transfer-Encoding' => 'binary',
]
);
@@ -250,9 +264,6 @@ class EntriesExport
}
$mobi->setContentProvider($content);
- // the browser inside Kindle Devices doesn't likes special caracters either, we limit to A-z/0-9
- $this->title = preg_replace('/[^A-Za-z0-9\-]/', '', $this->title);
-
return Response::create(
$mobi->toString(),
200,
@@ -260,7 +271,7 @@ class EntriesExport
'Accept-Ranges' => 'bytes',
'Content-Description' => 'File Transfer',
'Content-type' => 'application/x-mobipocket-ebook',
- 'Content-Disposition' => 'attachment; filename="' . $this->title . '.mobi"',
+ 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.mobi"',
'Content-Transfer-Encoding' => 'binary',
]
);
@@ -284,14 +295,6 @@ class EntriesExport
$pdf->SetSubject('Articles via wallabag');
$pdf->SetKeywords('wallabag');
- /*
- * Front page
- */
- $pdf->AddPage();
- $intro = '' . $this->title . '
' . $this->getExportInformation('tcpdf');
-
- $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true);
-
/*
* Adding actual entries
*/
@@ -300,6 +303,22 @@ class EntriesExport
$pdf->SetKeywords($tag->getLabel());
}
+ $publishedBy = $entry->getPublishedBy();
+ $authors = $this->translator->trans('export.unknown');
+ if (!empty($publishedBy)) {
+ $authors = implode(',', $publishedBy);
+ }
+
+ $pdf->addPage();
+ $html = '' . $entry->getTitle() . '
' .
+ '' .
+ '- ' . $this->translator->trans('entry.view.published_by') . '
- ' . $authors . '
' .
+ '- ' . $this->translator->trans('entry.metadata.reading_time') . '
- ' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '
' .
+ '- ' . $this->translator->trans('entry.metadata.added_on') . '
- ' . $entry->getCreatedAt()->format('Y-m-d') . '
' .
+ '- ' . $this->translator->trans('entry.metadata.address') . '
- ' . $entry->getUrl() . '
' .
+ '
';
+ $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
$pdf->AddPage();
$html = '' . $entry->getTitle() . '
';
$html .= $entry->getContent();
@@ -307,6 +326,14 @@ class EntriesExport
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
}
+ /*
+ * Last page
+ */
+ $pdf->AddPage();
+ $html = $this->getExportInformation('tcpdf');
+
+ $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
@@ -316,7 +343,7 @@ class EntriesExport
[
'Content-Description' => 'File Transfer',
'Content-type' => 'application/pdf',
- 'Content-Disposition' => 'attachment; filename="' . $this->title . '.pdf"',
+ 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.pdf"',
'Content-Transfer-Encoding' => 'binary',
]
);
@@ -362,7 +389,7 @@ class EntriesExport
200,
[
'Content-type' => 'application/csv',
- 'Content-Disposition' => 'attachment; filename="' . $this->title . '.csv"',
+ 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.csv"',
'Content-Transfer-Encoding' => 'UTF-8',
]
);
@@ -380,7 +407,7 @@ class EntriesExport
200,
[
'Content-type' => 'application/json',
- 'Content-Disposition' => 'attachment; filename="' . $this->title . '.json"',
+ 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.json"',
'Content-Transfer-Encoding' => 'UTF-8',
]
);
@@ -398,7 +425,7 @@ class EntriesExport
200,
[
'Content-type' => 'application/xml',
- 'Content-Disposition' => 'attachment; filename="' . $this->title . '.xml"',
+ 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.xml"',
'Content-Transfer-Encoding' => 'UTF-8',
]
);
@@ -424,7 +451,7 @@ class EntriesExport
200,
[
'Content-type' => 'text/plain',
- 'Content-Disposition' => 'attachment; filename="' . $this->title . '.txt"',
+ 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.txt"',
'Content-Transfer-Encoding' => 'UTF-8',
]
);
@@ -467,4 +494,15 @@ class EntriesExport
return str_replace('%IMAGE%', '', $info);
}
+
+ /**
+ * Return a sanitized version of the title by applying translit iconv
+ * and removing non alphanumeric characters, - and space.
+ *
+ * @return string Sanitized filename
+ */
+ private function getSanitizedFilename()
+ {
+ return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $this->title));
+ }
}
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index e3ff21f14..97eb874d2 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -253,6 +253,11 @@ entry:
confirm:
# delete: "Are you sure you want to remove that article?"
# delete_tag: "Are you sure you want to remove that tag from that article?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'Om'
@@ -402,6 +407,7 @@ tag:
# export:
# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
import:
# page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index c297ffb5d..0cf3b138e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -253,6 +253,11 @@ entry:
confirm:
delete: 'Bist du sicher, dass du diesen Artikel löschen möchtest?'
delete_tag: 'Bist du sicher, dass du diesen Tag vom Artikel entfernen möchtest?'
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'Über'
@@ -402,6 +407,7 @@ tag:
export:
footer_template: 'Generiert von wallabag mit Hilfe von %method%
Bitte öffne ein Ticket wenn du ein Problem mit der Darstellung von diesem E-Book auf deinem Gerät hast.
'
+ # unknown: 'Unknown'
import:
page_title: 'Importieren'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 169ae728e..6085be140 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -253,6 +253,11 @@ entry:
confirm:
delete: "Are you sure you want to remove that article?"
delete_tag: "Are you sure you want to remove that tag from that article?"
+ metadata:
+ reading_time: "Estimated reading time"
+ reading_time_minutes_short: "%readingTime% min"
+ address: "Address"
+ added_on: "Added on"
about:
page_title: 'About'
@@ -402,6 +407,7 @@ tag:
export:
footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+ unknown: 'Unknown'
import:
page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 039a1867c..f2a8fb890 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -253,6 +253,11 @@ entry:
confirm:
# delete: "Are you sure you want to remove that article?"
# delete_tag: "Are you sure you want to remove that tag from that article?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'Acerca de'
@@ -402,6 +407,7 @@ tag:
# export:
# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
import:
page_title: 'Importar'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index b3f2eb584..a5cbd7ecb 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -253,6 +253,11 @@ entry:
confirm:
# delete: "Are you sure you want to remove that article?"
# delete_tag: "Are you sure you want to remove that tag from that article?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'درباره'
@@ -402,6 +407,7 @@ tag:
# export:
# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
import:
page_title: 'درونریزی'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 5cdd836ea..a36d84ae1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -253,6 +253,11 @@ entry:
confirm:
delete: "Voulez-vous vraiment supprimer cet article ?"
delete_tag: "Voulez-vous vraiment supprimer ce tag de cet article ?"
+ metadata:
+ reading_time: "Durée de lecture estimée"
+ reading_time_minutes_short: "%readingTime% min"
+ address: "Adresse"
+ added_on: "Ajouté le"
about:
page_title: "À propos"
@@ -402,6 +407,7 @@ tag:
export:
footer_template: 'Généré par wallabag with %method%
Merci d''ouvrir un ticket si vous rencontrez des soucis d''affichage avec ce document sur votre support.
'
+ unknown: 'Inconnu'
import:
page_title: "Importer"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 83b3edcdd..1649c0e4f 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -253,6 +253,11 @@ entry:
confirm:
delete: "Vuoi veramente rimuovere quell'articolo?"
delete_tag: "Vuoi veramente rimuovere quell'etichetta da quell'articolo?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'A proposito'
@@ -402,6 +407,7 @@ tag:
# export:
# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
import:
page_title: 'Importa'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 95bc9560f..e2298f1f6 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -253,6 +253,11 @@ entry:
confirm:
delete: "Sètz segur de voler suprimir aqueste article ?"
delete_tag: "Sètz segur de voler levar aquesta etiqueta de l'article ?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'A prepaus'
@@ -402,6 +407,7 @@ tag:
export:
footer_template: 'Produch per wallabag amb %method%
Mercés de dobrir una sollicitacion s’avètz de problèmas amb l’afichatge d’aqueste E-Book sus vòstre periferic.
'
+ # unknown: 'Unknown'
import:
page_title: 'Importar'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index a64e60b01..a5712733b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -253,6 +253,11 @@ entry:
confirm:
delete: "Czy jesteś pewien, że chcesz usunąć ten artykuł?"
delete_tag: "Czy jesteś pewien, że chcesz usunąć ten tag, z tego artykułu?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'O nas'
@@ -401,7 +406,8 @@ tag:
placeholder: 'Możesz dodać kilka tagów, oddzielając je przecinkami.'
export:
- footer_template: 'Stworzone przez wallabag z %method%
Proszę zgłoś sprawę, jeżeli masz problem z wyświetleniem tego e-booka na swoim urządzeniu.
'
+ footer_template: 'Stworzone przez wallabag z %method%
Proszę zgłoś sprawę, jeżeli masz problem z wyświetleniem tego e-booka na swoim urządzeniu.
'
+ # unknown: 'Unknown'
import:
page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index 58d2d0587..1ccf49e1b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -253,6 +253,11 @@ entry:
confirm:
# delete: "Are you sure you want to remove that article?"
# delete_tag: "Are you sure you want to remove that tag from that article?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'Sobre'
@@ -402,6 +407,7 @@ tag:
# export:
# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
import:
page_title: 'Importar'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 564fed945..6c0e18e1c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -253,6 +253,11 @@ entry:
confirm:
# delete: "Are you sure you want to remove that article?"
# delete_tag: "Are you sure you want to remove that tag from that article?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'Despre'
@@ -402,6 +407,7 @@ tag:
# export:
# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
import:
# page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
index 5f210c934..48753b555 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
@@ -241,6 +241,11 @@ entry:
save_label: 'Сохранить'
public:
shared_by_wallabag: "Запись была опубликована wallabag"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'О'
@@ -388,6 +393,10 @@ tag:
add: 'Добавить'
placeholder: 'Вы можете добавить несколько тегов, разделенных запятой.'
+# export:
+# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
+
import:
page_title: 'Импорт'
page_description: 'Добро пожаловать в импортер wallabag. Выберите сервис, из которого вы хотите перенести данные.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
index 9d22f90d3..5524b1f12 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
@@ -251,6 +251,11 @@ entry:
confirm:
delete: "คุณแน่ใจหรือไม่ว่าคุณต้องการลบบทความนี้?"
delete_tag: "คุณแน่ใจหรือไม่ว่าคุณต้องการลบแท็กจากบทความนี้?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'เกี่ยวกับ'
@@ -400,6 +405,7 @@ tag:
export:
footer_template: 'ผลิตโดย wallabag กับ %method%
ให้ทำการเปิด ฉบับนี้ ถ้าคุณมีข้อบกพร่องif you have trouble with the display of this E-Book on your device.
'
+ # unknown: 'Unknown'
import:
page_title: 'นำข้อมูลเช้า'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 4c71f0b96..e2156d479 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -251,6 +251,11 @@ entry:
confirm:
# delete: "Are you sure you want to remove that article?"
# delete_tag: "Are you sure you want to remove that tag from that article?"
+ metadata:
+ # reading_time: "Estimated reading time"
+ # reading_time_minutes_short: "%readingTime% min"
+ # address: "Address"
+ # added_on: "Added on"
about:
page_title: 'Hakkımızda'
@@ -400,6 +405,7 @@ tag:
# export:
# footer_template: 'Produced by wallabag with %method%
Please open an issue if you have trouble with the display of this E-Book on your device.
'
+# unknown: 'Unknown'
import:
page_title: 'İçe Aktar'
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
index 6f3308e56..0c3d4c83a 100644
--- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
@@ -98,7 +98,7 @@ class ExportControllerTest extends WallabagCoreTestCase
$headers = $client->getResponse()->headers;
$this->assertSame('application/x-mobipocket-ebook', $headers->get('content-type'));
- $this->assertSame('attachment; filename="' . preg_replace('/[^A-Za-z0-9\-]/', '', $content->getTitle()) . '.mobi"', $headers->get('content-disposition'));
+ $this->assertSame('attachment; filename="' . $this->getSanitizedFilename($content->getTitle()) . '.mobi"', $headers->get('content-disposition'));
$this->assertSame('binary', $headers->get('content-transfer-encoding'));
}
@@ -126,7 +126,7 @@ class ExportControllerTest extends WallabagCoreTestCase
$headers = $client->getResponse()->headers;
$this->assertSame('application/pdf', $headers->get('content-type'));
- $this->assertSame('attachment; filename="Tag_entries articles.pdf"', $headers->get('content-disposition'));
+ $this->assertSame('attachment; filename="Tag foo bar articles.pdf"', $headers->get('content-disposition'));
$this->assertSame('binary', $headers->get('content-transfer-encoding'));
}
@@ -212,7 +212,7 @@ class ExportControllerTest extends WallabagCoreTestCase
$headers = $client->getResponse()->headers;
$this->assertSame('application/json', $headers->get('content-type'));
- $this->assertSame('attachment; filename="' . $contentInDB->getTitle() . '.json"', $headers->get('content-disposition'));
+ $this->assertSame('attachment; filename="' . $this->getSanitizedFilename($contentInDB->getTitle()) . '.json"', $headers->get('content-disposition'));
$this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
$content = json_decode($client->getResponse()->getContent(), true);
@@ -281,4 +281,9 @@ class ExportControllerTest extends WallabagCoreTestCase
$this->assertNotEmpty('created_at', (string) $content->entry[0]->created_at);
$this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at);
}
+
+ private function getSanitizedFilename($title)
+ {
+ return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $title));
+ }
}