mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 14:48:30 +00:00
Model.internalScanFolderSubs: Scan only requested subs.
This reverts the change introduced in 9b9fe0d Reduce scanning effort. That commit caused us to automatically ignore the basename of the specified subs and instead scan closest known root folder. For example, in a folder that looks like: Sync/ ├── 00 │ ├── one │ ├── three │ └── two ├── 01 │ ├── one │ ├── three │ └── two ├── 02 │ ├── one │ ├── three │ └── two └── one calling '/rest/db/scan?folder=default&sub=01' called filepath.Walk on the whole Sync/ folder instead of just the desired subfolder. This contradicts the scan behavior promised by the documentation. This is related to #2151.
This commit is contained in:
parent
1353e3916f
commit
6c33188af3
@ -1324,14 +1324,13 @@ func (m *Model) internalScanFolderSubs(folder string, subs []string) error {
|
||||
nextSub:
|
||||
for _, sub := range subs {
|
||||
for sub != "" {
|
||||
parent := filepath.Dir(sub)
|
||||
if parent == "." || parent == string(filepath.Separator) {
|
||||
parent = ""
|
||||
}
|
||||
if _, ok = fs.Get(protocol.LocalDeviceID, parent); ok {
|
||||
if _, ok = fs.Get(protocol.LocalDeviceID, sub); ok {
|
||||
break
|
||||
}
|
||||
sub = parent
|
||||
sub = filepath.Dir(sub)
|
||||
if sub == "." || sub == string(filepath.Separator) {
|
||||
sub = ""
|
||||
}
|
||||
}
|
||||
for _, us := range unifySubs {
|
||||
if strings.HasPrefix(sub, us) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user