From f41b558fe58cb90ed19eae50f20ad7f876c42900 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 13 May 2013 17:33:32 -0700 Subject: [PATCH] Exclude symlinked folders from fuzzy finder This can put the fuzzy finder in an infinite loop if a cycle occurs. --- .../fuzzy-finder/lib/load-paths-handler.coffee | 10 ++++++++-- .../fuzzy-finder/spec/fuzzy-finder-spec.coffee | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/packages/fuzzy-finder/lib/load-paths-handler.coffee b/src/packages/fuzzy-finder/lib/load-paths-handler.coffee index 3b66ddda7..01c28f3e6 100644 --- a/src/packages/fuzzy-finder/lib/load-paths-handler.coffee +++ b/src/packages/fuzzy-finder/lib/load-paths-handler.coffee @@ -35,9 +35,15 @@ class PathLoader loadPath: (path) -> @asyncCallStarting() - fs.stat path, (error, stats) => + fs.lstat path, (error, stats) => unless error? - if stats.isDirectory() + if stats.isSymbolicLink() + @asyncCallStarting() + fs.stat path, (error, stats) => + unless error? + @pathLoaded(path) if stats.isFile() + @asyncCallDone() + else if stats.isDirectory() @loadFolder(path) unless @isIgnored(path) else if stats.isFile() @pathLoaded(path) diff --git a/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee b/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee index 1ca2973d4..3182c49e7 100644 --- a/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee +++ b/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee @@ -71,6 +71,17 @@ describe 'FuzzyFinder', -> runs -> expect(finderView.list.find("li:contains(symlink-to-file)")).toExist() + it "excludes symlinked folder paths", -> + rootView.attachToDom() + finderView.maxItems = Infinity + rootView.trigger 'fuzzy-finder:toggle-file-finder' + + waitsFor "all project paths to load", 5000, -> + not finderView.reloadProjectPaths + + runs -> + expect(finderView.list.find("li:contains(symlink-to-dir)")).not.toExist() + describe "when root view's project has no path", -> beforeEach -> project.setPath(null)