Backend: Keep plus in titles generated from file names
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
2283f6019a
commit
bf6c79ad67
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/photoprism/photoprism/pkg/fs"
|
"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.
|
// FileTitle returns the string with the first characters of each word converted to uppercase.
|
||||||
func FileTitle(s string) string {
|
func FileTitle(s string) string {
|
||||||
|
|
|
@ -83,4 +83,7 @@ func TestFileTitle(t *testing.T) {
|
||||||
t.Run("ampersand", func(t *testing.T) {
|
t.Run("ampersand", func(t *testing.T) {
|
||||||
assert.Equal(t, "Coouussinen, Du & Ich", FileTitle("coouussinen, du & ich"))
|
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 +"))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue