Skip to content

Commit 25d4609

Browse files
committed
escape HTML tags
1 parent cde136b commit 25d4609

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pygeoapi/util.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,14 @@ def to_json(dict_: dict, pretty: bool = False) -> str:
261261
else:
262262
indent = None
263263

264-
return json.dumps(dict_, default=json_serial, indent=indent,
265-
separators=(',', ':'))
264+
LOGGER.debug('Dumping JSON')
265+
json_dump = json.dumps(dict_, default=json_serial, indent=indent,
266+
separators=(',', ':'))
267+
268+
LOGGER.debug('Removing < and >')
269+
json_dump = json_dump.replace('<', '&lt').replace('>', '&gt')
270+
271+
return json_dump
266272

267273

268274
def format_datetime(value: str, format_: str = DATETIME_FORMAT) -> str:

0 commit comments

Comments
 (0)