File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -216,12 +216,28 @@ func (s *Scanner) handleFileEvent(event fsnotify.Event) {
216
216
return
217
217
}
218
218
219
- fi , err := os .Stat (event .Name )
219
+ // Use Lstat to get symlink info without following it
220
+ fi , err := os .Lstat (event .Name )
220
221
if err != nil {
221
222
return
222
223
}
223
224
224
- if fi .IsDir () {
225
+ // If it's a symlink, we need to check what it points to
226
+ var targetIsDir bool
227
+ if fi .Mode ()& os .ModeSymlink != 0 {
228
+ // For symlinks, check the target
229
+ targetFi , err := os .Stat (event .Name )
230
+ if err != nil {
231
+ logger .Debug ("Symlink target not accessible:" , event .Name , err )
232
+ return
233
+ }
234
+ targetIsDir = targetFi .IsDir ()
235
+ logger .Debug ("Symlink changed:" , event .Name , "-> target is dir:" , targetIsDir )
236
+ } else {
237
+ targetIsDir = fi .IsDir ()
238
+ }
239
+
240
+ if targetIsDir {
225
241
logger .Debug ("Directory changed:" , event .Name )
226
242
} else {
227
243
logger .Debug ("File changed:" , event .Name )
You can’t perform that action at this time.
0 commit comments