From 6a3942024a2e7eb0846207c235cbc197efea4cad Mon Sep 17 00:00:00 2001 From: richblack Date: Wed, 29 Jul 2026 21:00:00 +0800 Subject: [PATCH] =?UTF-8?q?t149:=20Folders()=20=E6=94=B6=20accounts[].watc?= =?UTF-8?q?h=5Ffolders=E2=80=94=E2=80=94=E4=BF=AE=E5=A4=9A=E5=B8=B3?= =?UTF-8?q?=E8=99=9F=E7=94=A8=E6=88=B6=E3=80=8C=E6=8C=89=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=B2=92=E5=8F=8D=E6=87=89=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(無單數欄位),初版寫錯已修正。 --- direct.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/direct.go b/direct.go index ce1d844..fa5ce2f 100644 --- a/direct.go +++ b/direct.go @@ -270,6 +270,15 @@ func (c *DirectConfig) Folders() []string { for _, p := range c.WatchFolders { add(p) } + // t149(2026-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 }