aboutsummaryrefslogtreecommitdiff
path: root/app/Services
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-09-09 22:56:34 +0200
committerGravatar GitHub <noreply@github.com> 2022-09-09 22:56:34 +0200
commit0c472402f22816daa66982a815febc464c4856c8 (patch)
tree6bae9004580a5e2106f35f2d9432b405f1bceacc /app/Services
parentadf1c3bd9a2feb02227b5468bc0559deb34b60bf (diff)
Workaround invalid OPMLs (#4591)
* Workaround invalid OPMLs #fix https://github.com/FreshRSS/FreshRSS/issues/4590 Accept OPML files lacking text attributes * Tolerate missing head element
Diffstat (limited to 'app/Services')
-rw-r--r--app/Services/ImportService.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php
index 2e70d4b81..4910e9cc4 100644
--- a/app/Services/ImportService.php
+++ b/app/Services/ImportService.php
@@ -123,6 +123,9 @@ class FreshRSS_Import_Service {
* @return FreshRSS_Feed|null a feed.
*/
private function addFeedOpml($feed_elt, $parent_cat, $dryRun = false) {
+ if (empty($feed_elt['xmlUrl'])) {
+ return null;
+ }
if ($parent_cat == null) {
// This feed has no parent category so we get the default one
$this->catDAO->checkDefault();
@@ -135,15 +138,9 @@ class FreshRSS_Import_Service {
// We get different useful information
$url = Minz_Helper::htmlspecialchars_utf8($feed_elt['xmlUrl']);
- $name = Minz_Helper::htmlspecialchars_utf8($feed_elt['text']);
- $website = '';
- if (isset($feed_elt['htmlUrl'])) {
- $website = Minz_Helper::htmlspecialchars_utf8($feed_elt['htmlUrl']);
- }
- $description = '';
- if (isset($feed_elt['description'])) {
- $description = Minz_Helper::htmlspecialchars_utf8($feed_elt['description']);
- }
+ $name = Minz_Helper::htmlspecialchars_utf8($feed_elt['text'] ?? '');
+ $website = Minz_Helper::htmlspecialchars_utf8($feed_elt['htmlUrl'] ?? '');
+ $description = Minz_Helper::htmlspecialchars_utf8($feed_elt['description'] ?? '');
try {
// Create a Feed object and add it in DB