Commit f5ff50b6 authored by Zachary Seguin's avatar Zachary Seguin

Handle double quotes and single quotes when removing encoding (Resolves #27)

parent 76b75701
Pipeline #145 passed with stages
in 5 minutes and 50 seconds
......@@ -29,6 +29,7 @@ import pytz
import dateutil.parser
from celery.utils.log import get_task_logger
from lxml.etree import XMLSyntaxError
import re
from . import app, celery, db, redis
from ..xml import alert
......@@ -203,7 +204,7 @@ def process_heartbeat():
@celery.task(default_retry_delay=10, max_retries=None)
def process_alert(xml):
try:
xml = xml.replace('encoding="UTF-8"', '')
xml = re.sub("encoding=['\"][^'\"]*['\"]", "", xml, flags=re.IGNORECASE)
# Get the XML representation of the alert
a = alert.parseString(xml)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment