diff options
| author | 2023-09-04 10:09:37 +0200 | |
|---|---|---|
| committer | 2023-09-04 10:09:37 +0200 | |
| commit | 1c7c1016f4a5147003ed1c438b8a386a63a53cab (patch) | |
| tree | a0639042ac205cd20863cd24496e79ddae3f562e /app/Controllers/importExportController.php | |
| parent | da405ceee628dca739a12b234a6094a8ebae9c94 (diff) | |
Fix JSON export/import (#5626)
* Fix import with empty content
fix https://github.com/FreshRSS/FreshRSS/issues/5622
Cherry picks on https://github.com/FreshRSS/FreshRSS/pull/5584
* Fix export of tags / labels
Article-defined tags were wrongly exported as user-defined labels.
* Fix export of tags / labels
Article-defined tags were wrongly exported as user-defined labels.
* Fix bug with many labels
* Better typing
* Comments
Diffstat (limited to 'app/Controllers/importExportController.php')
| -rw-r--r-- | app/Controllers/importExportController.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 9c18b608f..807a355db 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -309,7 +309,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController { $limits = FreshRSS_Context::$system_conf->limits; // First, we check feeds of articles are in DB (and add them if needed). - foreach ($items as $item) { + foreach ($items as &$item) { if (!isset($item['guid']) && isset($item['id'])) { $item['guid'] = $item['id']; } @@ -382,7 +382,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController { // Then, articles are imported. $newGuids = []; $this->entryDAO->beginTransaction(); - foreach ($items as $item) { + foreach ($items as &$item) { if (empty($item['guid']) || empty($article_to_feed[$item['guid']])) { // Related feed does not exist for this entry, do nothing. continue; @@ -427,14 +427,17 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController { } else { $url = ''; } + if (!is_string($url)) { + $url = ''; + } $title = empty($item['title']) ? $url : $item['title']; - if (!empty($item['content']['content'])) { + if (isset($item['content']['content']) && is_string($item['content']['content'])) { $content = $item['content']['content']; - } elseif (!empty($item['summary']['content'])) { + } elseif (isset($item['summary']['content']) && is_string($item['summary']['content'])) { $content = $item['summary']['content']; - } elseif (!empty($item['content'])) { + } elseif (isset($item['content']) && is_string($item['content'])) { $content = $item['content']; //FeedBin } else { $content = ''; |
