WebClient: add test cases for new backend code

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-11-05 09:37:16 +01:00
parent 1acc2151cf
commit 2ee2098a48
3 changed files with 133 additions and 13 deletions

View File

@@ -1087,7 +1087,7 @@ func (s *httpdServer) handleShareGetPDF(w http.ResponseWriter, r *http.Request)
}
defer common.Connections.Remove(connection.GetID())
info, err := connection.Stat(name, 0)
info, err := connection.Stat(name, 1)
if err != nil {
s.renderClientMessagePage(w, r, "Unable to get file", "", getRespStatus(err), err, "")
return
@@ -1547,7 +1547,7 @@ func (s *httpdServer) handleWebClientProfilePost(w http.ResponseWriter, r *http.
}
if userMerged.CanManagePublicKeys() {
for k := range r.Form {
if strings.HasPrefix(k, "public_keys[") {
if hasPrefixAndSuffix(k, "public_keys[", "][public_key]") {
r.Form.Add("public_keys", r.Form.Get(k))
}
}
@@ -1590,7 +1590,7 @@ func getShareFromPostFields(r *http.Request) (*dataprovider.Share, error) {
return share, err
}
for k := range r.Form {
if strings.HasPrefix(k, "paths[") {
if hasPrefixAndSuffix(k, "paths[", "][path]") {
r.Form.Add("paths", r.Form.Get(k))
}
}