From 7001b2687f38c9abbff423ac0a9f9c77aab490ea Mon Sep 17 00:00:00 2001
From: Kiyoshi Aman <sheila@vulpine.house>
Date: Fri, 28 Oct 2022 00:56:13 -0700
Subject: [PATCH] Chessa::URI::Default::tcard: fix author support

---
 scripts/Chessa/URI/Default.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/Chessa/URI/Default.pm b/scripts/Chessa/URI/Default.pm
index dcb9a04..f74fc85 100644
--- a/scripts/Chessa/URI/Default.pm
+++ b/scripts/Chessa/URI/Default.pm
@@ -234,7 +234,10 @@ sub tcard($self, $t, $authority) {
 
     my $title = $t->findvalue('//meta[@property="twitter:title"]/@content');
     if ($title eq '') { $title = $t->findvalue('//meta[@property="og:title"]/@content') };
-    my $author = $t->findvalue('//meta[@property="author"]/@content');
+    my $author = undef;
+    if ($t->exists('//meta[@property="author"]')) {
+        $author = $t->findvalue('//meta[@property="author"]/@content');
+    }
     my $text = $t->findvalue('//meta[@property="twitter:description"]/@content');
     if ($text eq '') { $text = $t->findvalue('//meta[@property="og:description"]/@content') };
     $text =~ s/\r?\n/ /g;
@@ -242,7 +245,7 @@ sub tcard($self, $t, $authority) {
     my $modified  = $t->findvalue('//meta[@property="article:modified_time');
 
     my $out = $self->{msg}($authority, $title);
-    if ($author ne '') {
+    if (defined($author)) {
         $out .= ' ' . $self->{msg}('Author', $author);
     }
     if ($published ne '') {
-- 
GitLab