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

[BUG]接口返回的数据没有做转义,导致实际返回的数据有问题 #30797

Closed
qingqingguan opened this issue May 13, 2024 · 13 comments
Assignees
Labels
状态:无法复现 最新发布版本不能复现的问题

Comments

@qingqingguan
Copy link

联系方式

18229918212@163.com

MeterSphere 版本

v2.10.14-lts-a7298117

使用外置数据库

问题描述

接口本应返回的数据格式是个json格式,但是metersphere这边返回的数据是个错误的json,metersphere这边返回的数据为{"error_info":{"errno":1,"error":"程序正常执行"},"data":{"addtime":1715584513,"alias":0,"file":"{"sourceId":9054932,"eeoFileType":"eeo-image","scheduleType":"eeoconv-img","output":{"IMAGE":{"thumbnail":"thumb/20240513/vfXM2jq3uD3QUtx6.jpg","midsize":"midsize/20240513/vfXM2jq3uD3QUtx6.jpg","large":"large/20240513/vfXM2jq3uD3QUtx6.jpg"},"width":1920,"height":1080}}","fileExtension":"jpg","fileName":"??1","fileSize":151,"path":"upload/trans//","resourceFileType":0,"resourceId":9054932,"resourceType":3,"shareId":8143050,"shareUid":460278}}

同样的参数postman和apifox返回的数据就是正常的经过转义后的json格式,正常的json数据为
{
"error_info": {
"errno": 1,
"error": "程序正常执行"
},
"data": {
"addtime": 1715584550,
"alias": 0,
"file": "{"sourceId":9054932,"eeoFileType":"eeo-image","scheduleType":"eeoconv-img","output":{"IMAGE":{"thumbnail":"thumb/20240513/vfXM2jq3uD3QUtx6.jpg","midsize":"midsize/20240513/vfXM2jq3uD3QUtx6.jpg","large":"large/20240513/vfXM2jq3uD3QUtx6.jpg"},"width":1920,"height":1080}}",
"fileExtension": "jpg",
"fileName": "??1",
"fileSize": 151,
"path": "upload/trans//",
"resourceFileType": 0,
"resourceId": 9054932,
"resourceType": 3,
"shareId": 8024332,
"shareUid": 117456
}
}

重现步骤

{"error_info":{"errno":1,"error":"程序正常执行"},"data":{"addtime":1715584513,"alias":0,"file":"{"sourceId":9054932,"eeoFileType":"eeo-image","scheduleType":"eeoconv-img","output":{"IMAGE":{"thumbnail":"thumb/20240513/vfXM2jq3uD3QUtx6.jpg","midsize":"midsize/20240513/vfXM2jq3uD3QUtx6.jpg","large":"large/20240513/vfXM2jq3uD3QUtx6.jpg"},"width":1920,"height":1080}}","fileExtension":"jpg","fileName":"??1","fileSize":151,"path":"upload/trans//","resourceFileType":0,"resourceId":9054932,"resourceType":3,"shareId":8143050,"shareUid":460278}}

期待的正确结果

{
"error_info": {
"errno": 1,
"error": "程序正常执行"
},
"data": {
"addtime": 1715584550,
"alias": 0,
"file": "{"sourceId":9054932,"eeoFileType":"eeo-image","scheduleType":"eeoconv-img","output":{"IMAGE":{"thumbnail":"thumb/20240513/vfXM2jq3uD3QUtx6.jpg","midsize":"midsize/20240513/vfXM2jq3uD3QUtx6.jpg","large":"large/20240513/vfXM2jq3uD3QUtx6.jpg"},"width":1920,"height":1080}}",
"fileExtension": "jpg",
"fileName": "??1",
"fileSize": 151,
"path": "upload/trans//",
"resourceFileType": 0,
"resourceId": 9054932,
"resourceType": 3,
"shareId": 8024332,
"shareUid": 117456
}
}

相关日志输出

No response

附加信息

No response

@github-actions github-actions bot added the 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 label May 13, 2024
@13290445582
Copy link

13290445582 commented May 13, 2024

您好,您给出的这两段json,看起来是一样的,没看到转义内容。建议使用Jmeter 5.5测试下,我们与Jmeter 5.5保持一致。也可以提供下您测试所用的接口、参数、环境,帮助我们复现下。
image

@github-actions github-actions bot added 状态:待用户反馈 and removed 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 labels May 13, 2024
@13290445582 13290445582 added 状态:无法复现 最新发布版本不能复现的问题 and removed 状态:待用户反馈 labels May 13, 2024
@qingqingguan
Copy link
Author

辛苦再帮忙看看。
metersphere返回的:
{"error_info":{"errno":1,"error":"程序正常执行"},"data":{"addtime":1715592516,"alias":0,"file":"{"sourceId":9079191,"eeoFileType":"eeo-image","scheduleType":"eeoconv-img","output":{"IMAGE":{"thumbnail":"thumb/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png","midsize":"midsize/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png","large":"large/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png"},"width":2521,"height":1107}}","fileExtension":"png","fileName":"1","fileSize":186,"path":"upload/trans//","resourceFileType":0,"resourceId":9079191,"resourceType":3,"shareId":8024342,"shareUid":460278}}
metersphere返回的到json.cn解析之后会变成这样:

image

正常的json:
{
"error_info": {
"errno": 1,
"error": "程序正常执行"
},
"data": {
"addtime": 1715592317,
"alias": 0,
"file": "{"sourceId":9079191,"eeoFileType":"eeo-image","scheduleType":"eeoconv-img","output":{"IMAGE":{"thumbnail":"thumb/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png","midsize":"midsize/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png","large":"large/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png"},"width":2521,"height":1107}}",
"fileExtension": "png",
"fileName": "1",
"fileSize": 186,
"path": "upload/trans//",
"resourceFileType": 0,
"resourceId": 9079191,
"resourceType": 3,
"shareId": 8053568,
"shareUid": 460278
}
}

@github-actions github-actions bot added the 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 label May 13, 2024
@qingqingguan
Copy link
Author

postman返回之后是这样的,请参考下
image

@13290445582
Copy link

您好,将测试接口、参数、环境导出提供下吧,单看响应体也无法找到问题所在。或者您可以在JMeter上试一下,看下JMeter返回的响应体是什么样子的。

@github-actions github-actions bot added 状态:待用户反馈 and removed 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 labels May 13, 2024
@qingqingguan
Copy link
Author

Jmeter返回结果:
{"error_info":{"errno":1,"error":"程序正常执行"},"data":{"addtime":1715594391,"alias":0,"file":"{"sourceId":9079191,"eeoFileType":"eeo-image","scheduleType":"eeoconv-img","output":{"IMAGE":{"thumbnail":"thumb/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png","midsize":"midsize/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png","large":"large/20240508/00_01_82e4699-cf15-4047-981a-1f5a10ddf1d.png"},"width":2521,"height":1107}}","fileExtension":"png","fileName":"1","fileSize":186,"path":"upload/trans//","resourceFileType":0,"resourceId":9079191,"resourceType":3,"shareId":8143077,"shareUid":460278}}

image

@github-actions github-actions bot added 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 and removed 状态:待用户反馈 labels May 13, 2024
@13290445582
Copy link

jmx文件方便提供吗,仅测试复现用。

@github-actions github-actions bot added 状态:待用户反馈 and removed 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 labels May 13, 2024
@qingqingguan
Copy link
Author

im聊天.zip

@github-actions github-actions bot added 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 and removed 状态:待用户反馈 labels May 13, 2024
@qingqingguan
Copy link
Author

@13290445582 jmx文件已提供,辛苦查看。

@13290445582
Copy link

您好,根据您提供的文件,在MeterSphere内测试与Jmeter的返回结果一致。
image
image
image

@github-actions github-actions bot added 状态:待用户反馈 and removed 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 labels May 17, 2024
@qingqingguan
Copy link
Author

image

@github-actions github-actions bot added the 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 label May 17, 2024
@qingqingguan
Copy link
Author

image
我们用的这个版本有问题。

@qingqingguan
Copy link
Author

image

@13290445582
Copy link

您好,经过多次尝试,本地测试一直是正常的。建议您新建个空的工作空间、项目测试下或者弄个新的环境测试下,后续我们仍会留意这种问题, 有反馈会同步给您,感谢理解与支持。

@github-actions github-actions bot added 状态:待用户反馈 and removed 状态:待处理 已分配给相关处理人等待处理人处理并更新状态 labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
状态:无法复现 最新发布版本不能复现的问题
Projects
None yet
Development

No branches or pull requests

3 participants