summaryrefslogtreecommitdiffstats
path: root/g2h/commit_page.py
diff options
context:
space:
mode:
Diffstat (limited to 'g2h/commit_page.py')
-rw-r--r--g2h/commit_page.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/g2h/commit_page.py b/g2h/commit_page.py
index a998417..03d74ab 100644
--- a/g2h/commit_page.py
+++ b/g2h/commit_page.py
@@ -2,18 +2,24 @@ import os
from .page import Page
+def _redact_local_segment(local_segment):
+ if len(local_segment) == 0:
+ return ''
+ if len(local_segment) < 6:
+ return local_segment[0] + '...'
+ return local_segment[:2] + '...'
+
def redact_email(email):
if email is None or len(email) == 0:
return ''
if '@' not in email:
- return email[0] + '...' + email[-1]
+ return _redact_local_segment(email)
local, domain = email.split('@')
- redacted_local = local[0] + '...' + local[-1] if len(local) > 0 else ''
- redacted_domain = domain.replace('.', '...')
+ redacted_local = _redact_local_segment(local)
- return redacted_local + '@' + redacted_domain
+ return redacted_local + '@' + domain
class CommitPage(Page):
def __init__(self, out_dir, name, commit, content_subdir):