Skip to content

refactor(func): replace GinWithValue with GinAppendValues#2475

Merged
j2rong4cn merged 2 commits into
OpenListTeam:mainfrom
j2rong4cn:pr/refactor7
May 15, 2026
Merged

refactor(func): replace GinWithValue with GinAppendValues#2475
j2rong4cn merged 2 commits into
OpenListTeam:mainfrom
j2rong4cn:pr/refactor7

Conversation

@j2rong4cn
Copy link
Copy Markdown
Member

Description / 描述

原本GinWithValue是用来代替Gin.Set方法的,现在改成更合适的GinAppendValues

Motivation and Context / 背景

How Has This Been Tested? / 测试

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

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 renames GinWithValue to GinAppendValues and changes its semantics so that values appended to the request context are visible through previously-held context references (mutating an embedded context.Context inside a new requestContext wrapper instead of replacing c.Request with a brand-new immutable context chain). All call sites in server/ are updated. The PR also includes an unrelated refactor of Cloud189PC.Put upload-method dispatch in drivers/189pc/driver.go.

Changes:

  • Introduce requestContext wrapper and GinAppendValues (replacing GinWithValue); rename ContentWithValue to ContentWithValues.
  • Update all middleware and handler call sites under server/ to use GinAppendValues.
  • Unrelated: restructure Cloud189PC.Put upload-method selection and remove a duplicate秒传 branch.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
server/common/common.go New requestContext + GinAppendValues with mutable-context semantics; rename helper to ContentWithValues.
server/webdav.go Switch all GinWithValue calls to GinAppendValues.
server/middlewares/auth.go Same call-site rename across Auth/Authn.
server/middlewares/check.go Rename in StoragesLoaded.
server/middlewares/down.go Rename in PathParse and Down.
server/middlewares/sharing.go Rename in SharingIdParse/EmptyPathParse.
server/handles/fsread.go Rename in FsList/FsDirs/FsGet/FsOther.
server/handles/fsmanage.go Rename in FsRemoveEmptyDirectory.
server/handles/fsbatch.go Rename in FsRecursiveMove/FsBatchRename/FsRegexRename.
server/handles/archive.go Rename in FsArchiveMeta/FsArchiveList.
drivers/189pc/driver.go Unrelated Put dispatch refactor; comment typo "妙传".

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

Comment thread drivers/189pc/driver.go
Comment thread server/common/common.go
@j2rong4cn j2rong4cn merged commit 219564b into OpenListTeam:main May 15, 2026
24 checks passed
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.

3 participants