Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/home/toolbar/BatchRename.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const BatchRename = () => {

const renameObj: RenameObj = {
src_name: obj.name,
new_name: srcName() + tempNum + "." + suffix,
new_name: srcName() + tempNum + (suffix == "" ? "" : "." + suffix),
}
tempNum = (parseInt(tempNum) + 1)
.toString()
Expand Down
5 changes: 4 additions & 1 deletion src/pages/home/toolbar/Delete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export const Delete = () => {
onClick={async () => {
const resp = await ok(
pathname(),
selectedObjs().map((obj) => obj.name),
selectedObjs().map((obj) => ({
id: obj.id,
name: obj.name,
})),
)
handleRespWithNotifySuccess(resp, () => {
refresh()
Expand Down
6 changes: 6 additions & 0 deletions src/types/obj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum ObjType {
}

export interface Obj {
id: string
name: string
size: number
is_dir: boolean
Expand All @@ -24,6 +25,11 @@ export type StoreObj = Obj & {
selected?: boolean
}

export type IDName = {
id: string
name: string
}

export type RenameObj = {
src_name: string
new_name: string
Expand Down
13 changes: 11 additions & 2 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
RenameObj,
ArchiveMeta,
ArchiveList,
IDName,
} from "~/types"
import { r } from "."

Expand Down Expand Up @@ -104,8 +105,16 @@ export const fsCopy = (
return r.post("/fs/copy", { src_dir, dst_dir, names, overwrite })
}

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


export const fsRemoveEmptyDirectory = (src_dir: string): PEmptyResp => {
Expand Down