Skip to content

Commit

Permalink
fix: uri encode fs delete
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Song <theevansong@gmail.com>
  • Loading branch information
ferothefox committed Oct 18, 2024
1 parent c24e8a3 commit fe541d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion apps/frontend/src/composables/pyroServers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,9 @@ const moveFileOrFolder = (path: string, newPath: string) => {
};

const deleteFileOrFolder = (path: string, recursive: boolean) => {
const encodedPath = encodeURIComponent(path);
return retryWithAuth(async () => {
return await PyroFetch(`/delete?path=${path}&recursive=${recursive}`, {
return await PyroFetch(`/delete?path=${encodedPath}&recursive=${recursive}`, {
method: "DELETE",
override: internalServerRefrence.value.fs.auth,
});
Expand Down
6 changes: 2 additions & 4 deletions apps/frontend/src/pages/servers/manage/[id]/files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,8 @@ const downloadFile = async (item: any) => {
const deleteItem = async () => {
try {
await props.server.fs?.deleteFileOrFolder(
`${currentPath.value}/${selectedItem.value.name}`.replace("//", "/"),
selectedItem.value.type === "directory",
);
const path = `${currentPath.value}/${selectedItem.value.name}`.replace("//", "/");
await props.server.fs?.deleteFileOrFolder(path, selectedItem.value.type === "directory");
currentPage.value = 1;
items.value = [];
await fetchData();
Expand Down

0 comments on commit fe541d9

Please sign in to comment.