virtual folders: allow overlapped mapped paths if quota is disabled

See #95
This commit is contained in:
Nicola Murino
2020-06-10 09:11:32 +02:00
parent 7807fa7cc2
commit 8e22dd1b13
8 changed files with 192 additions and 13 deletions

View File

@@ -784,9 +784,15 @@ func validateUserVirtualFolders(user *User) error {
QuotaFiles: v.QuotaFiles,
})
for k, virtual := range mappedPaths {
if isMappedDirOverlapped(k, cleanedMPath) {
return &ValidationError{err: fmt.Sprintf("invalid mapped folder %#v overlaps with mapped folder %#v",
v.MappedPath, k)}
if GetQuotaTracking() > 0 {
if isMappedDirOverlapped(k, cleanedMPath) {
return &ValidationError{err: fmt.Sprintf("invalid mapped folder %#v overlaps with mapped folder %#v",
v.MappedPath, k)}
}
} else {
if k == cleanedMPath {
return &ValidationError{err: fmt.Sprintf("duplicated mapped folder %#v", v.MappedPath)}
}
}
if isVirtualDirOverlapped(virtual, cleanedVPath) {
return &ValidationError{err: fmt.Sprintf("invalid virtual folder %#v overlaps with virtual folder %#v",