Skip to content

Commit 812deea

Browse files
authored
Merge pull request #69 from rbourgeat/fix-no-avatar
Fix build error when no avatar
2 parents 497460a + c587f98 commit 812deea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mkdocs_git_committers_plugin_2/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def get_contributors_to_file(self, path):
114114
authors.append({'login': commit['author']['login'],
115115
'name': commit['author']['login'],
116116
'url': commit['author']['html_url'],
117-
'avatar': commit['author']['avatar_url']
117+
'avatar': commit['author']['avatar_url'] if user['avatar_url'] is not None else ''
118118
})
119119
if commit['committer'] and commit['committer']['login'] and commit['committer']['login'] not in [author['login'] for author in authors]:
120120
authors.append({'login': commit['committer']['login'],
121121
'name': commit['committer']['login'],
122122
'url': commit['committer']['html_url'],
123-
'avatar': commit['committer']['avatar_url']
123+
'avatar': commit['committer']['avatar_url'] if user['avatar_url'] is not None else ''
124124
})
125125
if commit['commit'] and commit['commit']['message'] and '\nCo-authored-by:' in commit['commit']['message']:
126126
github_coauthors_exist = True
@@ -134,7 +134,7 @@ def get_contributors_to_file(self, path):
134134
authors.append({'login': self.gitlabauthors_cache[commit['author_name']]['username'],
135135
'name': commit['author_name'],
136136
'url': self.gitlabauthors_cache[commit['author_name']]['web_url'],
137-
'avatar': self.gitlabauthors_cache[commit['author_name']]['avatar_url']
137+
'avatar': self.gitlabauthors_cache[commit['author_name']]['avatar_url'] if user['avatar_url'] is not None else ''
138138
})
139139
else:
140140
# Fetch author from GitLab API
@@ -151,7 +151,7 @@ def get_contributors_to_file(self, path):
151151
authors.append({'login': user['username'],
152152
'name': user['name'],
153153
'url': user['web_url'],
154-
'avatar': user['avatar_url']
154+
'avatar': user['avatar_url'] if user['avatar_url'] is not None else ''
155155
})
156156
break
157157
else:

0 commit comments

Comments
 (0)