Skip to content

Commit

Permalink
Add logging for relative path check
Browse files Browse the repository at this point in the history
  • Loading branch information
sjagoe committed Dec 3, 2023
1 parent 578aa5b commit 1fe77a7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions haas/plugins/discoverer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def test_error(self):

def get_relpath(top_level_directory, fullpath):
normalized = os.path.normpath(fullpath)
logger.debug('Determine if %r is within %r',
normalized, top_level_directory)
relpath = os.path.relpath(normalized, top_level_directory)
logger.debug('Relative path is %r', relpath)
if os.path.isabs(relpath) or relpath.startswith('..'):
raise ValueError('Path not within project: {0}'.format(fullpath))
return relpath
Expand Down

0 comments on commit 1fe77a7

Please sign in to comment.