webclient: fix link for shares with a trailing space

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2023-10-29 07:33:56 +01:00
parent 116be362ba
commit 59378104b7
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
2 changed files with 2 additions and 4 deletions

View file

@ -208,8 +208,7 @@ func (s *Share) hashPassword() error {
func (s *Share) validatePaths() error {
var paths []string
for _, p := range s.Paths {
p = strings.TrimSpace(p)
if p != "" {
if strings.TrimSpace(p) != "" {
paths = append(paths, p)
}
}

View file

@ -1503,8 +1503,7 @@ func getShareFromPostFields(r *http.Request) (*dataprovider.Share, error) {
share.Name = strings.TrimSpace(r.Form.Get("name"))
share.Description = r.Form.Get("description")
for _, p := range r.Form["paths"] {
p = strings.TrimSpace(p)
if p != "" {
if strings.TrimSpace(p) != "" {
share.Paths = append(share.Paths, p)
}
}