From 11e05050f7d9457749a04b408a9b829269142fda Mon Sep 17 00:00:00 2001 From: Skia Date: Fri, 24 Feb 2017 02:45:37 +0100 Subject: [PATCH] Fix tests and force Markdown renderer to escape HTML --- core/markdown.py | 2 +- core/tests.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/markdown.py b/core/markdown.py index 116af0f5..5b905b55 100644 --- a/core/markdown.py +++ b/core/markdown.py @@ -121,7 +121,7 @@ class SithInlineLexer(InlineLexer): except: pass return super(SithInlineLexer, self)._process_link(m, link, title) -renderer = SithRenderer() +renderer = SithRenderer(escape=True) inline = SithInlineLexer(renderer) markdown = Markdown(renderer, inline=inline) diff --git a/core/tests.py b/core/tests.py index a9e9dc21..40b037a0 100644 --- a/core/tests.py +++ b/core/tests.py @@ -253,8 +253,8 @@ http://git.an response = self.client.get(reverse('core:page', kwargs={'page_name': 'guy'})) self.assertTrue(response.status_code == 200) self.assertTrue('

Guy bibou

\\n

http://git.an

\\n' + - '

Swag

\\n

<guy>Bibou</guy>

\\n' + - '

<script>alert('Guy');</script>

' in str(response.content)) + '

Swag

\\n<guy>Bibou</guy>' + + "<script>alert(\\'Guy\\');</script>" in str(response.content)) #TODO: many tests on the pages: # - renaming a page