Skip to content

Conversation

jenken827
Copy link
Contributor

@xrgzs xrgzs changed the title refactor:batch rename and remove refactor(fs): batch remove and rename Aug 22, 2025
@xrgzs xrgzs requested a review from Copilot August 24, 2025 12:02
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 the file system remove and rename operations to use ID-based operations for improved efficiency and reliability. The changes enable batch operations that can identify files by both ID and name, moving away from name-only identification.

  • Added ID field to file objects and created IDName type for batch operations
  • Updated fsRemove API to use IDName objects and File-Path header instead of dir parameter
  • Fixed batch rename suffix handling for files without extensions

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/types/obj.ts Added id field to Obj interface and created IDName type for batch operations
src/utils/api.ts Refactored fsRemove to use IDName array and File-Path header
src/pages/home/toolbar/Delete.tsx Updated delete operation to pass both id and name
src/pages/home/toolbar/BatchRename.tsx Fixed suffix handling for files without extensions

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

Comment on lines +108 to 118
export const fsRemove = (dir: string, names: IDName[]): PEmptyResp => {
return r.post(
"/fs/remove",
{ names },
{
headers: {
"File-Path": encodeURIComponent(dir),
},
},
)
}
Copy link
Preview

Copilot AI Aug 24, 2025

Choose a reason for hiding this comment

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

The function signature still accepts a dir parameter but the API call has changed to use a File-Path header. Consider renaming the parameter to filePath to better reflect its usage as a header value rather than a request body parameter.

Copilot uses AI. Check for mistakes.

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.

1 participant