Compare commits

...

5 Commits

Author SHA1 Message Date
Ralph Slooten
c1b03212d5 Merge branch 'release/v1.14.2' 2024-03-10 08:11:35 +13:00
Ralph Slooten
026d676901 Release v1.14.2 2024-03-10 08:11:31 +13:00
Ralph Slooten
e660d6bedd Chore: Allow setting of multiple message tags via plus addresses (#253) 2024-03-10 08:05:11 +13:00
Ralph Slooten
d1d0ce4737 Fix: Prevent runtime error when calculating total messages size of empty table (#263) 2024-03-10 07:48:44 +13:00
Ralph Slooten
bdea197a0f Merge tag 'v1.14.1' into develop
Release v1.14.1
2024-03-02 23:12:34 +13:00
3 changed files with 20 additions and 11 deletions

View File

@@ -2,6 +2,15 @@
Notable changes to Mailpit will be documented in this file.
## [v1.14.2]
### Chore
- Allow setting of multiple message tags via plus addresses ([#253](https://github.com/axllent/mailpit/issues/253))
### Fix
- Prevent runtime error when calculating total messages size of empty table ([#263](https://github.com/axllent/mailpit/issues/263))
## [v1.14.1]
### Chore

View File

@@ -51,7 +51,7 @@ func getDeletedSize() int64 {
// The total raw non-compressed messages size in bytes of all messages in the database
func totalMessagesSize() int64 {
var result int64
var result sql.NullInt64
err := sqlf.From("mailbox").
Select("SUM(Size)").To(&result).
QueryAndClose(nil, db, func(row *sql.Rows) {})
@@ -60,7 +60,7 @@ func totalMessagesSize() int64 {
return 0
}
return result
return result.Int64
}
// AddDeletedSize will add the value to the DeletedSize setting

View File

@@ -13,7 +13,7 @@ import (
)
var (
addressPlusRe = regexp.MustCompile(`^(.*){1,}\+(.*)@`)
addressPlusRe = regexp.MustCompile(`(?U)^(.*){1,}\+(.*)@`)
)
// SetMessageTags will set the tags for a given database ID
@@ -246,25 +246,25 @@ func (d DBMailSummary) tagsFromPlusAddresses() string {
tags := []string{}
for _, c := range d.To {
matches := addressPlusRe.FindAllStringSubmatch(c.String(), 1)
if len(matches) == 1 && config.ValidTagRegexp.MatchString(matches[0][2]) {
tags = append(tags, matches[0][2])
if len(matches) == 1 {
tags = append(tags, strings.Split(matches[0][2], "+")...)
}
}
for _, c := range d.Cc {
matches := addressPlusRe.FindAllStringSubmatch(c.String(), 1)
if len(matches) == 1 && config.ValidTagRegexp.MatchString(matches[0][2]) {
tags = append(tags, matches[0][2])
if len(matches) == 1 {
tags = append(tags, strings.Split(matches[0][2], "+")...)
}
}
for _, c := range d.Bcc {
matches := addressPlusRe.FindAllStringSubmatch(c.String(), 1)
if len(matches) == 1 && config.ValidTagRegexp.MatchString(matches[0][2]) {
tags = append(tags, matches[0][2])
if len(matches) == 1 {
tags = append(tags, strings.Split(matches[0][2], "+")...)
}
}
matches := addressPlusRe.FindAllStringSubmatch(d.From.String(), 1)
if len(matches) == 1 && config.ValidTagRegexp.MatchString(matches[0][2]) {
tags = append(tags, matches[0][2])
if len(matches) == 1 {
tags = append(tags, strings.Split(matches[0][2], "+")...)
}
return strings.Join(tags, ",")