t149: Folders() 收 accounts[].watch_folders——修多帳號用戶「按同步沒反應」

leo 07-29 實測揪出:按「立刻同步」毫無反應,log 顯示 "folders": null、results: []。
真因:Folders() 只讀頂層 watch_folder/watch_folders,**完全沒讀 Accounts[].WatchFolders**。
多帳號設定(新制)一律寫在 accounts[] 裡 ⇒ 掃描清單空 ⇒ 什麼都不做。
**每個多帳號用戶都會中**,不是 leo 特有。

驗:go build 過;純 accounts[] 設定 dry-run → folders = [/tmp/aaa /tmp/bbb](先前 null)。
註:AccountConfig 只有複數 WatchFolders(無單數欄位),初版寫錯已修正。
This commit is contained in:
2026-07-29 21:00:00 +08:00
parent 71e91aefbd
commit 6a3942024a
+9
View File
@@ -270,6 +270,15 @@ func (c *DirectConfig) Folders() []string {
for _, p := range c.WatchFolders {
add(p)
}
// t1492026-07-29 leo 實測揪出):**多帳號的看守資料夾在 Accounts[].WatchFolders**
// 先前只讀頂層 ⇒ 只在 accounts[] 設定的用戶,Folders() 回 nil ⇒ 掃描清單空 ⇒
// 按「立刻同步」毫無反應、log 顯示 "folders": null、results: []leo 就是這樣卡住的)。
// 頂層是舊制(單帳號);新制多帳號一律走 Accounts ⇒ 兩邊都要收。
for _, a := range c.Accounts {
for _, p := range a.WatchFolders {
add(expandHome(p))
}
}
return out
}