parent
009f9c297d
commit
625fd92130
9 changed files with 32 additions and 17 deletions
|
@ -3,7 +3,7 @@ import http from '@/api/http';
|
|||
export default (server: string, file: string): Promise<string> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.get(`/api/client/servers/${server}/files/contents`, {
|
||||
params: { file: file.split('/').map(item => encodeURIComponent(item)).join('/') },
|
||||
params: { file: encodeURI(decodeURI(file)) },
|
||||
transformResponse: res => res,
|
||||
responseType: 'text',
|
||||
})
|
||||
|
|
|
@ -17,7 +17,7 @@ export interface FileObject {
|
|||
|
||||
export default async (uuid: string, directory?: string): Promise<FileObject[]> => {
|
||||
const { data } = await http.get(`/api/client/servers/${uuid}/files/list`, {
|
||||
params: { directory: directory?.split('/').map(item => encodeURIComponent(item)).join('/') },
|
||||
params: { directory: encodeURI(directory ?? '/') },
|
||||
});
|
||||
|
||||
return (data.data || []).map(rawDataToFileObject);
|
||||
|
|
|
@ -2,7 +2,7 @@ import http from '@/api/http';
|
|||
|
||||
export default async (uuid: string, file: string, content: string): Promise<void> => {
|
||||
await http.post(`/api/client/servers/${uuid}/files/write`, content, {
|
||||
params: { file },
|
||||
params: { file: encodeURI(decodeURI(file)) },
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
|
|
Reference in a new issue