Skip to content

Commit

Permalink
Validate filenames correctly in GitHub webhook (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan authored and techman83 committed Nov 15, 2019
1 parent 701d286 commit 1eed50c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions netkan/netkan/webhooks/github_inflate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ def release_hook():
return '', 204


def ends_with_netkan(filename):
return filename.endswith('.netkan')


def ids_from_commits(commits):
files = set()
for commit in commits:
added = commit.get('added')
if added and added.endswith('.netkan'):
files |= set(added)
modified = commit.get('modified')
if modified and modified.endswith('.netkan'):
files |= set(modified)
files |= set(filter(ends_with_netkan,
commit.get('added', []) + commit.get('modified', [])))
return (Path(f).stem for f in files)


Expand Down

0 comments on commit 1eed50c

Please sign in to comment.