summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-01-28 16:02:39 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-01-28 16:20:52 -0700
commitf86afc9f4f372d0322d693e9b767d924e08a7682 (patch)
tree329bfd8332f2d0215e645ada504ecb5eca4c308f
parent9cb043b4cf9b273a170430b566135fde72d9ef55 (diff)
downloadmailscripts-f86afc9f4f372d0322d693e9b767d924e08a7682.tar.gz
gmi2email: cope with links in feeds missing the protocol
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rwxr-xr-xgmi2email12
1 files changed, 11 insertions, 1 deletions
diff --git a/gmi2email b/gmi2email
index f4a13a6..0d9861b 100755
--- a/gmi2email
+++ b/gmi2email
@@ -135,7 +135,17 @@ foreach my $sub (<$subs_fh>) {
for ($feed->entries) {
my $date = $_->issued // $_->modified;
$date = $date->epoch if $date;
- send_subscribed_gemtext($_->link, $feed->title, $_->title, $date);
+
+ my $link;
+ if ($_->link =~ m{^//}) {
+ $link = "gemini:" . $_->link;
+ } elsif ($_->link !~ m{^[a-z]+://}) {
+ $link = "gemini://" . $_->link;
+ } else {
+ $link = $_->link;
+ }
+
+ send_subscribed_gemtext($link, $feed->title, $_->title, $date);
}
} else {
die "$sub is not gemtext nor an Atom feed, so far as I can tell";