Workaround for https://github.com/miyagawa/xml-atom/issues/16
This commit is contained in:
parent
926d45001b
commit
10ed56e9d4
|
@ -176,19 +176,27 @@ sub update {
|
|||
sub atom_main_link {
|
||||
my ($self, $item) = @_; # XXX should probably be a method of $item
|
||||
for my $link ($item->link) {
|
||||
$self->log->info("checking href ", $link->href, "\n");
|
||||
if (defined $link->rel && $link->rel ne 'alternate') {
|
||||
$self->log->info("rel ", $link->rel, " unexpected, skip");
|
||||
# workaround for https://github.com/miyagawa/xml-atom/issues/16
|
||||
my $href = $link->href // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'href');
|
||||
my $rel = $link->rel // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'rel');
|
||||
my $type = $link->type // $link->elem->getAttributeNS('http://www.w3.org/2005/Atom', 'type');
|
||||
|
||||
if (!$href) {
|
||||
$self->log->warn("href undefined, skip");
|
||||
next;
|
||||
}
|
||||
if (defined $link->type && $link->type ne 'text/html') {
|
||||
$self->log->info("type ", $link->type, " unexpected, skip\n");
|
||||
$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 $link->href;
|
||||
return $href;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub invalidate_item_info {
|
||||
|
|
Loading…
Reference in New Issue