From 3a2df72bceeada0a0a4fc7b0cc7df7d926092451 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Fri, 5 Aug 2016 15:36:24 -0700 Subject: [PATCH] Add newlines to the ends of blocks more correctly --- certbot-nginx/certbot_nginx/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/certbot-nginx/certbot_nginx/parser.py b/certbot-nginx/certbot_nginx/parser.py index ca02b6316..4577f9fa5 100644 --- a/certbot-nginx/certbot_nginx/parser.py +++ b/certbot-nginx/certbot_nginx/parser.py @@ -518,8 +518,8 @@ def _add_directives(block, directives, replace): for directive in directives: _add_directive(block, directive, replace) last = block[-1] - if not (isinstance(last, str) and '\n' in last): - block.append('\n') + if not '\n' in last: # could be " \n " or ["\n"] ! + block.append(nginxparser.UnspacedList('\n')) REPEATABLE_DIRECTIVES = set(['server_name', 'listen', 'include'])