user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] PublicInbox::Inbox.pm: Default unset address to a one element array
@ 2020-05-15 21:11 Eric W. Biederman
  2020-05-16  7:42 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric W. Biederman @ 2020-05-15 21:11 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta


PublicInbox::Config.pm::_fill() assumes that address is an array.
Therefore when handling an unset address use an array containing a
single string, instead of a single string.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---

I accidentially created a public inbox without an address at some
point and had some nasty errors because the default value
we game to address is not an array.

 lib/PublicInbox/Inbox.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 617b692b14ca..002b980f4057 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -102,7 +102,7 @@ sub _set_limiter ($$$) {
 
 sub new {
 	my ($class, $opts) = @_;
-	my $v = $opts->{address} ||= 'public-inbox@example.com';
+	my $v = $opts->{address} ||= [ 'public-inbox@example.com' ];
 	my $p = $opts->{-primary_address} = ref($v) eq 'ARRAY' ? $v->[0] : $v;
 	$opts->{domain} = ($p =~ /\@(\S+)\z/) ? $1 : 'localhost';
 	my $pi_config = delete $opts->{-pi_config};
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-16  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 21:11 [PATCH] PublicInbox::Inbox.pm: Default unset address to a one element array Eric W. Biederman
2020-05-16  7:42 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).