You've already forked AstralRinth
forked from didirus/AstralRinth
fix: correct uri encode paths in fs module (#2922)
Signed-off-by: Evan Song <theevansong@gmail.com>
This commit is contained in:
@@ -703,7 +703,8 @@ const retryWithAuth = async (requestFn: () => Promise<any>) => {
|
|||||||
|
|
||||||
const listDirContents = (path: string, page: number, pageSize: number) => {
|
const listDirContents = (path: string, page: number, pageSize: number) => {
|
||||||
return retryWithAuth(async () => {
|
return retryWithAuth(async () => {
|
||||||
return await PyroFetch(`/list?path=${path}&page=${page}&page_size=${pageSize}`, {
|
const encodedPath = encodeURIComponent(path);
|
||||||
|
return await PyroFetch(`/list?path=${encodedPath}&page=${page}&page_size=${pageSize}`, {
|
||||||
override: internalServerRefrence.value.fs.auth,
|
override: internalServerRefrence.value.fs.auth,
|
||||||
retry: false,
|
retry: false,
|
||||||
});
|
});
|
||||||
@@ -712,7 +713,8 @@ const listDirContents = (path: string, page: number, pageSize: number) => {
|
|||||||
|
|
||||||
const createFileOrFolder = (path: string, type: "file" | "directory") => {
|
const createFileOrFolder = (path: string, type: "file" | "directory") => {
|
||||||
return retryWithAuth(async () => {
|
return retryWithAuth(async () => {
|
||||||
return await PyroFetch(`/create?path=${path}&type=${type}`, {
|
const encodedPath = encodeURIComponent(path);
|
||||||
|
return await PyroFetch(`/create?path=${encodedPath}&type=${type}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
contentType: "application/octet-stream",
|
contentType: "application/octet-stream",
|
||||||
override: internalServerRefrence.value.fs.auth,
|
override: internalServerRefrence.value.fs.auth,
|
||||||
@@ -722,7 +724,8 @@ const createFileOrFolder = (path: string, type: "file" | "directory") => {
|
|||||||
|
|
||||||
const uploadFile = (path: string, file: File) => {
|
const uploadFile = (path: string, file: File) => {
|
||||||
return retryWithAuth(async () => {
|
return retryWithAuth(async () => {
|
||||||
return await PyroFetch(`/create?path=${path}&type=file`, {
|
const encodedPath = encodeURIComponent(path);
|
||||||
|
return await PyroFetch(`/create?path=${encodedPath}&type=file`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
contentType: "application/octet-stream",
|
contentType: "application/octet-stream",
|
||||||
body: file,
|
body: file,
|
||||||
@@ -803,7 +806,8 @@ const deleteFileOrFolder = (path: string, recursive: boolean) => {
|
|||||||
|
|
||||||
const downloadFile = (path: string, raw?: boolean) => {
|
const downloadFile = (path: string, raw?: boolean) => {
|
||||||
return retryWithAuth(async () => {
|
return retryWithAuth(async () => {
|
||||||
const fileData = await PyroFetch(`/download?path=${path}`, {
|
const encodedPath = encodeURIComponent(path);
|
||||||
|
const fileData = await PyroFetch(`/download?path=${encodedPath}`, {
|
||||||
override: internalServerRefrence.value.fs.auth,
|
override: internalServerRefrence.value.fs.auth,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user