From: Eric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Date: Thu, 8 Feb 2018 03:32:05 +0000 (+0000)
Subject: watch_maildir: allow '-' in mail filename
X-Git-Tag: v1.1.0-pre1~253
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=da1189763600f25802d6054ac3414d799b9367d4;p=public-inbox.git

watch_maildir: allow '-' in mail filename

Hostnames can contain '-' and this allows public-inbox-watch(1)
to work on machines which generate Maildir files with '-' in
them.
---

diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index a3fab428..403b6cf9 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -170,7 +170,7 @@ sub _force_mid {
 sub _try_path {
 	my ($self, $path) = @_;
 	my @p = split(m!/+!, $path);
-	return if $p[-1] !~ /\A[a-zA-Z0-9][\w:,=\.]+\z/;
+	return if $p[-1] !~ /\A[a-zA-Z0-9][\-\w:,=\.]+\z/;
 	if ($p[-1] =~ /:2,([A-Z]+)\z/i) {
 		my $flags = $1;
 		return if $flags =~ /[DT]/; # no [D]rafts or [T]rashed mail