Backend: Keep plus in titles generated from file names

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-20 13:30:25 +02:00
parent 2283f6019a
commit bf6c79ad67
2 changed files with 4 additions and 1 deletions

View file

@ -7,7 +7,7 @@ import (
"github.com/photoprism/photoprism/pkg/fs"
)
var FileTitleRegexp = regexp.MustCompile("[\\p{L}\\-,':]{2,}|( & )?")
var FileTitleRegexp = regexp.MustCompile("[\\p{L}\\-,':&+]{2,}|( [&+] )?")
// FileTitle returns the string with the first characters of each word converted to uppercase.
func FileTitle(s string) string {

View file

@ -83,4 +83,7 @@ func TestFileTitle(t *testing.T) {
t.Run("ampersand", func(t *testing.T) {
assert.Equal(t, "Coouussinen, Du & Ich", FileTitle("coouussinen, du & ich"))
})
t.Run("plus", func(t *testing.T) {
assert.Equal(t, "Foo+Bar, Du + Ich & Er", FileTitle("Foo+bar, du + ich & er +"))
})
}