Skip to content

Commit

Permalink
Fix logic error preventing github integration.
Browse files Browse the repository at this point in the history
Need to check return code of rfind() for errors to avoid screwing
up the match check for a match on the following line, which
eventually leads to an invalid JSON exception.
  • Loading branch information
Richard Lee committed Jun 15, 2016
1 parent 248f579 commit e484750
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ide/tests/test_find_project_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,12 @@ def test_ignore_invalid_package_file(self):
"src/main.c",
"appinfo.json"
], "", "appinfo.json")

def test_PR_317(self):
""" PR 317 fixes a bug where find_project_root would fail with 11 character filenames """
self.run_test([
"MAINTAINERS",
"package.json",
"src/"
"src/main.c",
], "", "package.json")
2 changes: 2 additions & 0 deletions ide/utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def find_project_root_and_manifest(project_items):
# Check if the file is one of the kinds of manifest file
for name in MANIFEST_KINDS:
dir_end = base_dir.rfind(name)
if dir_end == -1:
continue
# Ensure that the file is actually a manifest file
if dir_end + len(name) == len(base_dir):
if is_manifest(name, item.read()):
Expand Down

0 comments on commit e484750

Please sign in to comment.