[Asterisk-code-review] rest-api-templates/asterisk processor - replace http line br... (asterisk[master])

Joshua C. Colp asteriskteam at digium.com
Tue Feb 26 09:14:02 CST 2019


Joshua C. Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/11041 )

Change subject: rest-api-templates/asterisk_processor - replace http line breaks with line feed
......................................................................

rest-api-templates/asterisk_processor - replace http line breaks with line feed

Including line breaks (<br>, <br/>, <br />) in certain parts of the rest-api
json definition (e.g. summary, notes) displays them correctly in swagger.
However, when the field gets converted to the wiki format those breaks get
escaped and show up in the text as the actual string literal "<br>" etc...

This patch makes it so when converting to the wiki format it replaces all line
break values (<br>, etc...) with line feeds ('\n').

Change-Id: Ie1c9faa0d1c5d622804cc0a21ce769095b08aa3d
---
M rest-api-templates/asterisk_processor.py
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Joshua C. Colp: Looks good to me, but someone else must approve; Approved for Submit
  Sean Bright: Looks good to me, approved



diff --git a/rest-api-templates/asterisk_processor.py b/rest-api-templates/asterisk_processor.py
index 5f8dbb5..de4732c 100644
--- a/rest-api-templates/asterisk_processor.py
+++ b/rest-api-templates/asterisk_processor.py
@@ -46,6 +46,8 @@
 
     @param str: String to escape
     """
+    # Replace all line breaks with line feeds
+    str = re.sub(r'<br\s*/?>', '\n', str)
     return re.sub(r'([{}\[\]])', r'\\\1', str)
 
 

-- 
To view, visit https://gerrit.asterisk.org/11041
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1c9faa0d1c5d622804cc0a21ce769095b08aa3d
Gerrit-Change-Number: 11041
Gerrit-PatchSet: 2
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190226/5cd4be9c/attachment.html>


More information about the asterisk-code-review mailing list