Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: 多行文本兼容 JSON、Markdown 格式 --story=119593627 #1444

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog
## [Version: 2.7.1] - 2024-10-15
【新增】pipeline管理工具集成
修复】兼容第三方应用传递 json 内容
【新增】pipeline管理工具集成
优化】多行文本兼容 JSON、Markdown 格式

## [Version: 2.7.0] - 2024-10-10
【新增】通知人员黑名单过滤
Expand Down
4 changes: 2 additions & 2 deletions docs/RELEASE_EN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog
## [Version: 2.7.1] - 2024-10-15
【Feature】Integrated pipeline management tool.
Fix】Ensure compatibility for third-party applications transmitting JSON content.
【Feature】Integrated pipeline management tool.
Improved】Ensure TEXT compatibility with JSON and Markdown formats.


## [Version: 2.7.0] - 2024-10-10
Expand Down
5 changes: 3 additions & 2 deletions itsm/component/constants/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@
("CUSTOM_API", "自定义API"),
]

XSS_FIELD_TYPE = [
"RICHTEXT"
FIELD_IGNORE_ESCAPE = [
"FILE",
"TEXT"
]

LAYOUT_CHOICES = [
Expand Down
18 changes: 3 additions & 15 deletions itsm/ticket/models/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
BK_PLUGIN_STATE,
SUSPENDED,
SHOW_BY_CONDITION,
VARIABLE_LEADER,
VARIABLE_LEADER, FIELD_IGNORE_ESCAPE,
)
from itsm.component.constants.trigger import (
CREATE_TICKET,
Expand Down Expand Up @@ -3085,20 +3085,8 @@ def fill_state_fields(self, fields):
filter_field_query_set = self.fields.filter(key__in=fields_map.keys())
for ticket_field in filter_field_query_set:
ticket_field.value = fields_map[ticket_field.key]["value"]
if isinstance(ticket_field.value, str):
need_escape = True
# 附件不做xss处理
if ticket_field.type == "FILE":
need_escape = False
# 如果文本是 json 格式,则不额外处理
if ticket_field.type == "TEXT":
try:
json.loads(ticket_field.value)
need_escape = False
except Exception:
pass
if need_escape:
ticket_field.value = texteditor_escape(ticket_field.value)
if isinstance(ticket_field.value, str) and ticket_field.type not in FIELD_IGNORE_ESCAPE:
ticket_field.value = texteditor_escape(ticket_field.value)

ticket_field.choice = fields_map[ticket_field.key].get("choice", [])
language_config = (
Expand Down
Loading