]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WwwAtomStream.pm
extindex: add some validation and config knobs for WWW
[public-inbox.git] / lib / PublicInbox / WwwAtomStream.pm
index 912f860ececa8e16e13a7782ae96b625d4d78bb7..f60251b7ef12c2779779e4e81bf9186689acca2e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Atom body stream for HTTP responses
@@ -100,7 +100,11 @@ sub atom_header {
        } else {
                $title = title_tag($ibx->description);
                $self_url .= 'new.atom';
-               $page_id = "mailto:$ibx->{-primary_address}";
+               if (defined(my $addr = $ibx->{-primary_address})) {
+                       $page_id = "mailto:$addr";
+               } else {
+                       $page_id = to_uuid($self_url);
+               }
        }
        qq(<?xml version="1.0" encoding="us-ascii"?>\n) .
        qq(<feed\nxmlns="http://www.w3.org/2005/Atom"\n) .