Backend: Keep ampersand in titles generated from file names
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
0da72687e6
commit
2283f6019a
|
@ -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 {
|
||||
|
|
|
@ -80,4 +80,7 @@ func TestFileTitle(t *testing.T) {
|
|||
t.Run("invalid words", func(t *testing.T) {
|
||||
assert.Equal(t, "", FileTitle("jg hg "))
|
||||
})
|
||||
t.Run("ampersand", func(t *testing.T) {
|
||||
assert.Equal(t, "Coouussinen, Du & Ich", FileTitle("coouussinen, du & ich"))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue