Merge pull request #2724 from plouj/master

rest/db/scan: Only scan the requested subdirectories/files.
This commit is contained in:
Jakob Borg 2016-01-22 21:03:23 -08:00
commit cc5f93e717
1 changed files with 6 additions and 7 deletions

View File

@ -1323,15 +1323,14 @@ func (m *Model) internalScanFolderSubs(folder string, subs []string) error {
var unifySubs []string var unifySubs []string
nextSub: nextSub:
for _, sub := range subs { for _, sub := range subs {
for sub != "" { for sub != "" && sub != ".stfolder" && sub != ".stignore" {
parent := filepath.Dir(sub) if _, ok = fs.Get(protocol.LocalDeviceID, sub); ok {
if parent == "." || parent == string(filepath.Separator) {
parent = ""
}
if _, ok = fs.Get(protocol.LocalDeviceID, parent); ok {
break break
} }
sub = parent sub = filepath.Dir(sub)
if sub == "." || sub == string(filepath.Separator) {
sub = ""
}
} }
for _, us := range unifySubs { for _, us := range unifySubs {
if strings.HasPrefix(sub, us) { if strings.HasPrefix(sub, us) {