Skip to content

[Core] Fix upload_private_file#83

Merged
KusaGumina merged 2 commits into
LagrangeDev:mainfrom
kengwang:fix/private-file-upload
Nov 17, 2025
Merged

[Core] Fix upload_private_file#83
KusaGumina merged 2 commits into
LagrangeDev:mainfrom
kengwang:fix/private-file-upload

Conversation

@kengwang
Copy link
Copy Markdown
Contributor

@kengwang kengwang commented Nov 17, 2025

Fix #70

Maybe not that elegant

Copilot AI review requested due to automatic review settings November 17, 2025 07:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #70 related to file upload functionality by correcting the MD5 checksum used in private file uploads. The main issue was that the protocol expects the MD5 hash of the first ~10MB of the file in certain fields, not the full file MD5.

Key changes:

  • Refactored MD5 checksum calculation to be performed before creating the upload request
  • Fixed NotOnlineFile.FileMd5 to use the correct 10MB MD5 checksum instead of the full file MD5
  • Added File10MMd5 parameter to FileUploadEventReq to pass the 10MB checksum explicitly

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
Lagrange.Core/Message/MessagePacker.cs Fixed to use File10MMd5 instead of FileMd5 for the protocol message field
Lagrange.Core/Internal/Services/System/FileUploadService.cs Removed duplicate MD5 calculation logic, now uses the pre-calculated value from the request
Lagrange.Core/Internal/Logic/OperationLogic.cs Moved 10MB MD5 calculation before request creation; applied same fix to both SendFriendFile and SendGroupFile methods
Lagrange.Core/Internal/Events/System/FileUploadEvent.cs Added md510m parameter and File10MMd5 property to the request event

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Lagrange.Core/Internal/Logic/OperationLogic.cs
Comment thread Lagrange.Core/Internal/Logic/OperationLogic.cs
Comment thread Lagrange.Core/Internal/Logic/OperationLogic.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@KusaGumina KusaGumina merged commit 5c39816 into LagrangeDev:main Nov 17, 2025
9 checks passed
@kengwang kengwang deleted the fix/private-file-upload branch November 17, 2025 09:40
Bemly pushed a commit to Bemly/CharonAnchor that referenced this pull request May 3, 2026
Co-authored-by: Wei FeiYang <wesley.f.young@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

upload_private_file API 异常

6 participants