File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -174,13 +174,26 @@ func (s *Sketch) supportedFiles() (paths.PathList, error) {
174
174
return err == nil
175
175
}
176
176
177
+ var loopErr error
178
+ explored := map [string ]bool {}
179
+ filterLoops := func (p * paths.Path ) bool {
180
+ dir := p .Canonical ().String ()
181
+ if explored [dir ] {
182
+ loopErr = errors .New ("directories symlink loop detected" )
183
+ return false
184
+ }
185
+ explored [dir ] = true
186
+ return true
187
+ }
188
+
177
189
files , err := s .FullPath .ReadDirRecursiveFiltered (
178
190
paths .AndFilter (
179
191
paths .OrFilter (
180
192
filterValidExtensions ,
181
193
filterOutBrokenLinks ,
182
194
),
183
195
filterOutBuildPaths ,
196
+ filterLoops ,
184
197
),
185
198
paths .AndFilter (
186
199
paths .FilterOutPrefixes ("." ),
@@ -191,6 +204,9 @@ func (s *Sketch) supportedFiles() (paths.PathList, error) {
191
204
if err != nil {
192
205
return nil , err
193
206
}
207
+ if loopErr != nil {
208
+ return nil , loopErr
209
+ }
194
210
return files , nil
195
211
}
196
212
You can’t perform that action at this time.
0 commit comments