summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-11-21 12:23:33 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-11-21 12:23:33 -0300
commitbf5ce4086647ddf8381b0e75e928c1f675b0cddf (patch)
tree1cec389a9b8ac7b4001e135c2819054955d4883f /src/leap
parent3cafd7ef3f6578a3f45d0b0218b8ca6d388be6d3 (diff)
Remove '+' suffix in email address.
This allows us to support encrypt mails to 'test_user@provider.com' even if was sent to 'test_user+optional_string@provider.com'.
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/keymanager/openpgp.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/leap/keymanager/openpgp.py b/src/leap/keymanager/openpgp.py
index 0c11d17b..cb46371c 100644
--- a/src/leap/keymanager/openpgp.py
+++ b/src/leap/keymanager/openpgp.py
@@ -297,6 +297,11 @@ class OpenPGPScheme(EncryptionScheme):
:rtype: OpenPGPKey
@raise KeyNotFound: If the key was not found on local storage.
"""
+ # Remove the identity suffix after the '+' until the '@'
+ # e.g.: test_user+something@provider.com becomes test_user@probider.com
+ # since the key belongs to the identity without the '+' suffix.
+ address = re.sub(r'\+.*\@', '@', address)
+
doc = self._get_key_doc(address, private)
if doc is None:
raise errors.KeyNotFound(address)