# HG changeset patch # User Marcin Kuzminski # Date 2019-05-27 09:40:15 # Node ID c982b816dc9238a3b127b913a782f55f1e63679a # Parent ad8cd9024ea7c4f223bf4c5dcea1f671dd11d00a hooks: do not crash when hook files are empty diff --git a/vcsserver/hook_utils/__init__.py b/vcsserver/hook_utils/__init__.py --- a/vcsserver/hook_utils/__init__.py +++ b/vcsserver/hook_utils/__init__.py @@ -170,8 +170,10 @@ def check_rhodecode_hook(hook_path): def read_hook_content(hook_path): - with open(hook_path, 'rb') as f: - content = f.read() + content = '' + if os.path.isfile(hook_path): + with open(hook_path, 'rb') as f: + content = f.read() return content