1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 18:17:03 +00:00

backport FROM <> fix from #291 for bug #283 (#296)

* bump nix go to 1.18

* backport FROM <> fix from #291 for bug #283
This commit is contained in:
James Hillyerd
2022-10-02 15:32:49 -07:00
committed by GitHub
parent 344c3ffb21
commit 66831d10c7
3 changed files with 5 additions and 3 deletions

View File

@@ -58,7 +58,7 @@ const (
// as quoted pair and in double quoted strings (?i) makes the regex case insensitive, (?:) is
// non-grouping sub-match. Accepts empty angle bracket value in options for 'AUTH=<>'.
var fromRegex = regexp.MustCompile(
`(?i)^FROM:\s*<((?:(?:\\>|[^>])+|"[^"]+"@[^>])+)?>( [\w= ]+(?:=<>)?)?$`)
`(?i)^FROM:\s*<((?:(?:\\>|[^>])+|"[^"]+"@[^>])+)?>( ([\w= ]|=<>)+)?$`)
func (s State) String() string {
switch s {
@@ -619,7 +619,7 @@ func (s *Session) parseCmd(line string) (cmd string, arg string, ok bool) {
// The leading space is mandatory.
func (s *Session) parseArgs(arg string) (args map[string]string, ok bool) {
args = make(map[string]string)
re := regexp.MustCompile(` (\w+)=(\w+)`)
re := regexp.MustCompile(` (\w+)=(\w+|<>)`)
pm := re.FindAllStringSubmatch(arg, -1)
if pm == nil {
s.logger.Warn().Msgf("Failed to parse arg string: %q", arg)