sync: better trim authors lines
This commit is contained in:
parent
f3eabd74fc
commit
8c87451d80
@ -6,6 +6,7 @@ import (
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
@ -36,7 +37,8 @@ func getAuthors(i Importer, tname string) ([]string, error) {
|
||||
} else {
|
||||
var ret []string
|
||||
re := regexp.MustCompile("^([^<]+)(?: +<(.*)>)?$")
|
||||
for _, a := range strings.Split(strings.TrimSpace(authors), "\n") {
|
||||
for _, a := range strings.Split(authors, "\n") {
|
||||
a = strings.TrimFunc(a, unicode.IsSpace)
|
||||
grp := re.FindStringSubmatch(a)
|
||||
if len(grp) < 2 || grp[2] == "" {
|
||||
ret = append(ret, a)
|
||||
|
Loading…
Reference in New Issue
Block a user