This commit is contained in:
Peter J. Holzer 2018-06-04 10:19:37 +02:00
parent 926d45001b
commit 10ed56e9d4
1 changed files with 20 additions and 12 deletions

View File

@ -176,19 +176,27 @@ sub update {
sub atom_main_link { sub atom_main_link {
my ($self, $item) = @_; # XXX should probably be a method of $item my ($self, $item) = @_; # XXX should probably be a method of $item
for my $link ($item->link) { for my $link ($item->link) {
$self->log->info("checking href ", $link->href, "\n"); # workaround for https://github.com/miyagawa/xml-atom/issues/16
if (defined $link->rel && $link->rel ne 'alternate') { my $href = $link->href // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'href');
$self->log->info("rel ", $link->rel, " unexpected, skip"); my $rel = $link->rel // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'rel');
next; my $type = $link->type // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'type');
}
if (defined $link->type && $link->type ne 'text/html') {
$self->log->info("type ", $link->type, " unexpected, skip\n");
next;
}
$self->log->info("match!\n");
return $link->href;
}
if (!$href) {
$self->log->warn("href undefined, skip");
next;
}
$self->log->info("checking href ", $href, "\n");
if (defined $rel && $rel ne 'alternate') {
$self->log->info("rel ", $rel, " unexpected, skip");
next;
}
if (defined $type && $type ne 'text/html') {
$self->log->info("type ", $type, " unexpected, skip\n");
next;
}
$self->log->info("match!\n");
return $href;
}
} }
sub invalidate_item_info { sub invalidate_item_info {