From 4112e4b15323041ebb291d7236d11294cec32a65 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 17 Nov 2014 16:32:29 +0100 Subject: [PATCH] Clean PEM file before including them in the metadata --- mellon/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mellon/utils.py b/mellon/utils.py index 505c7e4..27be775 100644 --- a/mellon/utils.py +++ b/mellon/utils.py @@ -21,7 +21,8 @@ def create_metadata(request): public_keys = [] for public_key in app_settings.PUBLIC_KEYS: if public_key.startswith('/'): - public_key = file(public_key).read() + # clean PEM file + public_key = ''.join(file(public_key).read().splitlines()[1:-1]) public_keys.append(public_key) name_id_formats = app_settings.NAME_ID_FORMATS return render_to_string('mellon/metadata.xml', {