aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-11-16 17:49:20 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-11-16 17:49:20 +0100
commit1d5006d83fc84a0c653d8e2db42a4cfbdebdc5bb (patch)
treecf9c015e3a65c8b5b53ded2cbbf10f216aefa306 /app/views/helpers
parent568b737b6c62ace5aaa6b3f6c968e2595ea70f55 (diff)
Error edge cases for JSON export
Diffstat (limited to 'app/views/helpers')
-rw-r--r--app/views/helpers/export/articles.phtml27
1 files changed, 18 insertions, 9 deletions
diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml
index 9acf3cc83..49c370023 100644
--- a/app/views/helpers/export/articles.phtml
+++ b/app/views/helpers/export/articles.phtml
@@ -17,9 +17,15 @@ echo rtrim(json_encode($articles, $options), " ]}\n\r\t"), "\n";
$first = true;
foreach ($this->entriesRaw as $entryRaw) {
+ if (empty($entryRaw)) {
+ continue;
+ }
$entry = FreshRSS_EntryDAO::daoToEntry($entryRaw);
if (!isset($this->feed)) {
$feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed());
+ if ($feed == null) {
+ $feed = $entry->feed(true);
+ }
} else {
$feed = $this->feed;
}
@@ -39,19 +45,22 @@ foreach ($this->entriesRaw as $entryRaw) {
'content' => $entry->content(),
),
'origin' => array(
- 'streamId' => $feed->id(),
- 'title' => $feed->name(),
- 'htmlUrl' => $feed->website(),
- 'feedUrl' => $feed->url(),
+ 'streamId' => $feed == null ? '' : $feed->id(),
+ 'title' => $feed == null ? '' : $feed->name(),
+ 'htmlUrl' => $feed == null ? '' : $feed->website(),
+ 'feedUrl' => $feed == null ? '' : $feed->url(),
)
);
- if ($first) {
- $first = false;
- } else {
- echo ",\n";
+ $line = json_encode($article, $options);
+ if ($line != '') {
+ if ($first) {
+ $first = false;
+ } else {
+ echo ",\n";
+ }
+ echo $line;
}
- echo json_encode($article, $options);
}
echo "\n]}\n";