def is_path_within_repo(app, path, repository_id):
 repo_path = os.path.abspath(repository_util.get_repository_by_id(app, repository_id).repo_path(app))
 resolved_path = os.path.realpath(path)
 return (os.path.commonprefix([repo_path, resolved_path]) == repo_path)

def is_path_within_repo ( app , path , repository_id ) : repo_path = os . path . abspath ( repository_util . get_repository_by_id ( app , repository_id ) . repo_path ( app ) ) resolved_path = os . path . realpath ( path ) return ( os . path . commonprefix ( [ repo_path , resolved_path ] ) == repo_path )
detect whether the given path is within the repository folder on the disk .