Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 876326 Details for
Bug 1067388
Python-behave crashes when html report is created with invalid chars are present in error message
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Don't crash on invalid XML chars
0001-Don-t-crash-on-invalid-XML-chars-in-embed.patch (text/plain), 2.31 KB, created by
Vadim Rutkovsky
on 2014-03-19 11:41:37 UTC
(
hide
)
Description:
Don't crash on invalid XML chars
Filename:
MIME Type:
Creator:
Vadim Rutkovsky
Created:
2014-03-19 11:41:37 UTC
Size:
2.31 KB
patch
obsolete
>From 13b026c96d0e4cb6e298258a808ffa80c1b5acc1 Mon Sep 17 00:00:00 2001 >From: Vadim Rutkovsky <vrutkovs@redhat.com> >Date: Wed, 19 Mar 2014 12:37:38 +0100 >Subject: [PATCH] Don't crash on invalid XML chars in embed > >--- > behave/formatter/html.py | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > >diff --git a/behave/formatter/html.py b/behave/formatter/html.py >index 88cb004..f5ef7ef 100644 >--- a/behave/formatter/html.py >+++ b/behave/formatter/html.py >@@ -5,7 +5,8 @@ import os.path > from behave.compat.collections import Counter > from setuptools.dist import pkg_resources > >-def _valid_XML_char_ordinal(i): >+def _valid_XML_char_ordinal(char): >+ i = ord(char) > return ( # conditions ordered by presumed frequency > 0x20 <= i <= 0xD7FF > or i in (0x9, 0xA, 0xD) >@@ -209,10 +210,11 @@ class HTMLFormatter(Formatter): > embed = ET.SubElement(step, 'pre', > {'id': "embed_%s" % self.embed_id, > 'style': 'display: none; white-space: pre-wrap;'}) >- cleaned_error_message = ''.join( >- c for c in result.error_message if valid_XML_char_ordinal(ord(c)) >- ) >- embed.text = cleaned_error_message >+ cleaned_error_message = filter(_valid_XML_char_ordinal, result.error_message) >+ try: >+ embed.text = cleaned_error_message >+ except ValueError: >+ print("Cannot embed error message as it contains nonvalid XML chars") > embed.tail = u' ' > > if result.status == 'failed': >@@ -277,14 +279,14 @@ class HTMLFormatter(Formatter): > caption = u'Data' > link.text = unicode(caption) > >- cleaned_data = ''.join( >- c for c in data if valid_XML_char_ordinal(ord(c)) >- ) >- >+ cleaned_data = filter(_valid_XML_char_ordinal, data) > embed = ET.SubElement(span, 'pre', > {'id': "embed_%s" % self.embed_id, > 'style': 'display: none'}) >- embed.text = cleaned_data >+ try: >+ embed.text = cleaned_data >+ except ValueError: >+ print("Cannot embed text as it contains nonvalid XML chars") > embed.tail = u' ' > > def embedding(self, mime_type, data, caption=None): >-- >1.8.5.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1067388
:
865473
| 876326