Skip to content

Conversation

jenken827
Copy link
Contributor

@jenken827 jenken827 commented Aug 20, 2025

很多网盘原生支持批量重命名和删除,但是目前openlist对于这两种操作是通过循环调用单次重命名和删除实现的,量大时效率非常低下,还容易导致失败(有些api有调用频率限制)。
修改点如下:
1.支持了原生批量重命名和删除
2.文件相关操作有大量重复的对于path的解析及鉴权代码,优化集中到中间件中
3.修复在批量重命名选择序列模式(第二个模式)时,如果文件本身没有扩展名,重命名后会多出一个"."的问题(前端)

Frontend: OpenListTeam/OpenList-Frontend#174

Copy link
Contributor

@Copilot 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 refactors file operations to support native batch rename and remove operations instead of using inefficient loops, while centralizing path validation and authentication logic in middleware.

  • Adds support for native batch rename and batch remove operations through new driver interfaces
  • Consolidates duplicate path parsing and authentication code into reusable middleware functions
  • Implements batch operations for Baidu Netdisk and 123 Open cloud storage drivers

Reviewed Changes

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

Show a summary per file
File Description
server/router.go Adds middleware to batch rename and remove endpoints
server/middlewares/fsup.go Removes old upload middleware (replaced by generic fs middleware)
server/middlewares/fs.go Creates new centralized middleware for file operations with path validation and authentication
server/handles/fsmanage.go Refactors remove handler to use batch operations and middleware context
server/handles/fsbatch.go Simplifies batch rename handler using new middleware and batch operations
internal/op/fs.go Adds BatchRemove function supporting native batch operations
internal/model/obj.go Defines new data structures for batch operations (IDName, RenameObj)
internal/fs/fs.go Implements BatchRename and BatchRemove functions with fallback to individual operations
internal/driver/driver.go Adds BatchRename and BatchRemove interfaces
internal/conf/const.go Adds StorageKey constant for context storage
drivers/baidu_netdisk/driver.go Implements BatchRename and BatchRemove for Baidu Netdisk
drivers/123_open/util.go Adds batch rename utility and modifies trash function for batch operations
drivers/123_open/driver.go Implements BatchRename and BatchRemove for 123 Open with chunking support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@xrgzs xrgzs changed the title refactor:batch remove and rename refactor(fs): batch remove and rename Aug 22, 2025
@xrgzs
Copy link
Member

xrgzs commented Aug 24, 2025

@hshpy
Copy link
Contributor

hshpy commented Aug 24, 2025

@xrgzs xrgzs added enhancement 增强/功能请求 go Pull requests that update go code labels Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 增强/功能请求 go Pull requests that update go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants