"math/big"
"os"
"path"
+ "path/filepath"
"sort"
"strings"
"time"
res = append(res, cc.NewErrReply(t, "You are not allowed to create folders."))
return res, err
}
- newFolderPath := cc.Server.Config.FileRoot
folderName := string(t.GetField(fieldFileName).Data)
folderName = path.Join("/", folderName)
+ var subPath string
+
// fieldFilePath is only present for nested paths
if t.GetField(fieldFilePath).Data != nil {
var newFp FilePath
if err != nil {
return nil, err
}
- newFolderPath += newFp.String()
+
+ for _, pathItem := range newFp.Items {
+ subPath = filepath.Join("/", subPath, string(pathItem.Name))
+ }
}
- newFolderPath = path.Join(newFolderPath, folderName)
+ newFolderPath := path.Join(cc.Server.Config.FileRoot, subPath, folderName)
// TODO: check path and folder name lengths
// Handle special case for drop box folders
if fp.IsDropbox() && !authorize(cc.Account.Access, accessViewDropBoxes) {
- res = append(res, cc.NewReply(t))
+ res = append(res, cc.NewErrReply(t, "You are not allowed to view drop boxes."))
return res, err
}