From 41b09f8de373e52d7f99f81133ad59ddc33ba373 Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Tue, 13 Jan 2026 18:23:13 -1000 Subject: [PATCH] ipfswatch: fix panic on broken link Fix panic when broken link is created in watch directory. Closes #10017 --- cmd/ipfswatch/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/ipfswatch/main.go b/cmd/ipfswatch/main.go index 3ba5dd3d9..a25dcbcab 100644 --- a/cmd/ipfswatch/main.go +++ b/cmd/ipfswatch/main.go @@ -150,6 +150,7 @@ func run(ipfsPath, watchPath string) error { log.Printf("received event: %s", e) isDir, err := IsDirectory(e.Name) if err != nil { + log.Println(err) continue } switch e.Op { @@ -220,7 +221,7 @@ func addTree(w *fsnotify.Watcher, root string) error { return filepath.SkipDir case isDir: log.Println(path) - if err := w.Add(path); err != nil { + if err = w.Add(path); err != nil { return err } default: @@ -233,7 +234,10 @@ func addTree(w *fsnotify.Watcher, root string) error { func IsDirectory(path string) (bool, error) { fileInfo, err := os.Stat(path) - return fileInfo.IsDir(), err + if err != nil { + return false, err + } + return fileInfo.IsDir(), nil } func IsHidden(path string) bool {