Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
Sign in
Sign up
Fetch the repository succeeded.
Open Source
>
Wechat Projects
>
Wechat Development Package
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
169
Star
1.5K
Fork
409
RHQYZ
/
DotNetCore.SKIT.FlurlHttpClient.Wechat
Code
Issues
4
Pull Requests
1
Insights
Pipelines
Service
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
会话内容存档拉取聊天记录存在JSON转义的BUG
Done
#I8SY9T
jstzxxy
Opened this issue
2024-01-02 15:48
**问题类型** 请在此选择你的问题类型: - [ ] 报告缺陷:发现源代码中的漏洞、运行发生的异常、或文档里的错误。 --- **关于问题或建议的简单描述** 请在此填写你遇到的问题或你想要的功能。 在使用WechatWorkFinanceClient拉取聊天记录时出现了Json转义失败的错误提示 --- **与问题或建议相关的源代码** 对于报告缺陷,请在此粘贴与问题相关的代码,或提供可复现问题的最小化项目(可提供仓库地址或 GitHub Gist)。 对于请求新功能,请在此粘贴已有实现思路或解决方案。 注意,请不要以截图形式提供代码。 ```csharp try { int ret = /* 获取聊天记录数据 */ IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetChatData(_sdkPtr, request.LastSequence, request.Limit, _proxyAddress!, _proxyAuthentication!, (request.Timeout ?? _timeout) / 1000, dataPtr) : IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetChatData(_sdkPtr, request.LastSequence, request.Limit, _proxyAddress!, _proxyAuthentication!, (request.Timeout ?? _timeout) / 1000, dataPtr) : throw new PlatformNotSupportedException(); if (ret == 0) { //int dataSize = /* 获取聊天记录数据内容长度 */ // IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetSliceLen(dataPtr) : // IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetSliceLen(dataPtr) : // throw new PlatformNotSupportedException(); IntPtr dataContentPtr = /* 获取聊天记录数据内容 */ IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetContentFromSlice(dataPtr) : IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetContentFromSlice(dataPtr) : throw new PlatformNotSupportedException(); string dataContent = MarshalerHelper.PtrToStringUTF8(dataContentPtr); response = JsonSerializer.Deserialize<Models.GetChatRecordsResponse>(dataContent); response.RawBytes = Encoding.UTF8.GetBytes(dataContent); } response.ReturnCode = ret; return response; } catch (Exception ex) { throw new WechatWorkFinanceException("Failed to fetch chat data. Please see the inner exception for more details.", ex); } ``` --- **异常堆栈或异常原因** SKIT.FlurlHttpClient.Wechat.Work.WechatWorkFinanceException: Failed to decrypt chat data. Please see the inner exception for more details. ---> System.Text.Json.JsonException: '0x14' is invalid within a JSON string. The string should be correctly escaped. Path: $.text.content | LineNumber: 0 | BytePositionInLine: 1143. ---> System.Text.Json.JsonReaderException: '0x14' is invalid within a JSON string. The string should be correctly escaped. LineNumber: 0 | BytePositionInLine: 1143. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeStringAndValidate(ReadOnlySpan`1 data, Int32 idx) at System.Text.Json.Utf8JsonReader.ConsumeString() at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options) at SKIT.FlurlHttpClient.Wechat.Work.SDK.Finance.WechatWorkFinanceClient.<>c__DisplayClass18_0.<ExecuteDecryptChatRecordAsync>b__0() --- End of inner exception stack trace --- at SKIT.FlurlHttpClient.Wechat.Work.SDK.Finance.WechatWorkFinanceClient.<>c__DisplayClass18_0.<ExecuteDecryptChatRecordAsync>b__0() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at WechatWorkSystem.WechatWorkSdks.FinanceChatRecordProxy.DecryptChatRecordAsync(DecryptChatRecordRequest request, CancellationToken cancellationToken) --- **发生问题的运行环境** 请在此填写以下几项内容: 1. 操作系统:Windows Server 2012 R2 2. .NET 版本:.NET 5.0 3. 使用的模块及版本:SKIT.FlurlHttpClient.Wechat.Work.SDK.Finance 4. 其他环境信息。 --- **补充说明** 请在此填写任何其他可以定位问题或帮助说明的信息。
**问题类型** 请在此选择你的问题类型: - [ ] 报告缺陷:发现源代码中的漏洞、运行发生的异常、或文档里的错误。 --- **关于问题或建议的简单描述** 请在此填写你遇到的问题或你想要的功能。 在使用WechatWorkFinanceClient拉取聊天记录时出现了Json转义失败的错误提示 --- **与问题或建议相关的源代码** 对于报告缺陷,请在此粘贴与问题相关的代码,或提供可复现问题的最小化项目(可提供仓库地址或 GitHub Gist)。 对于请求新功能,请在此粘贴已有实现思路或解决方案。 注意,请不要以截图形式提供代码。 ```csharp try { int ret = /* 获取聊天记录数据 */ IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetChatData(_sdkPtr, request.LastSequence, request.Limit, _proxyAddress!, _proxyAuthentication!, (request.Timeout ?? _timeout) / 1000, dataPtr) : IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetChatData(_sdkPtr, request.LastSequence, request.Limit, _proxyAddress!, _proxyAuthentication!, (request.Timeout ?? _timeout) / 1000, dataPtr) : throw new PlatformNotSupportedException(); if (ret == 0) { //int dataSize = /* 获取聊天记录数据内容长度 */ // IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetSliceLen(dataPtr) : // IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetSliceLen(dataPtr) : // throw new PlatformNotSupportedException(); IntPtr dataContentPtr = /* 获取聊天记录数据内容 */ IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetContentFromSlice(dataPtr) : IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetContentFromSlice(dataPtr) : throw new PlatformNotSupportedException(); string dataContent = MarshalerHelper.PtrToStringUTF8(dataContentPtr); response = JsonSerializer.Deserialize<Models.GetChatRecordsResponse>(dataContent); response.RawBytes = Encoding.UTF8.GetBytes(dataContent); } response.ReturnCode = ret; return response; } catch (Exception ex) { throw new WechatWorkFinanceException("Failed to fetch chat data. Please see the inner exception for more details.", ex); } ``` --- **异常堆栈或异常原因** SKIT.FlurlHttpClient.Wechat.Work.WechatWorkFinanceException: Failed to decrypt chat data. Please see the inner exception for more details. ---> System.Text.Json.JsonException: '0x14' is invalid within a JSON string. The string should be correctly escaped. Path: $.text.content | LineNumber: 0 | BytePositionInLine: 1143. ---> System.Text.Json.JsonReaderException: '0x14' is invalid within a JSON string. The string should be correctly escaped. LineNumber: 0 | BytePositionInLine: 1143. at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeStringAndValidate(ReadOnlySpan`1 data, Int32 idx) at System.Text.Json.Utf8JsonReader.ConsumeString() at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options) at SKIT.FlurlHttpClient.Wechat.Work.SDK.Finance.WechatWorkFinanceClient.<>c__DisplayClass18_0.<ExecuteDecryptChatRecordAsync>b__0() --- End of inner exception stack trace --- at SKIT.FlurlHttpClient.Wechat.Work.SDK.Finance.WechatWorkFinanceClient.<>c__DisplayClass18_0.<ExecuteDecryptChatRecordAsync>b__0() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at WechatWorkSystem.WechatWorkSdks.FinanceChatRecordProxy.DecryptChatRecordAsync(DecryptChatRecordRequest request, CancellationToken cancellationToken) --- **发生问题的运行环境** 请在此填写以下几项内容: 1. 操作系统:Windows Server 2012 R2 2. .NET 版本:.NET 5.0 3. 使用的模块及版本:SKIT.FlurlHttpClient.Wechat.Work.SDK.Finance 4. 其他环境信息。 --- **补充说明** 请在此填写任何其他可以定位问题或帮助说明的信息。
Comments (
5
)
Sign in
to comment
Status
Done
Backlog
Doing
Done
Closed
Assignees
Not set
Labels
bug
Not set
Label settings
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
No related branch
main
archive/v2.x
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
参与者(1)
C#
1
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
git@gitee.com:fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
fudiwei
DotNetCore.SKIT.FlurlHttpClient.Wechat
DotNetCore.SKIT.FlurlHttpClient.Wechat
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register