Skip to content

Commit 8c8feff

Browse files
committed
Encode all parts of the URI individually, closes pterodactyl#2620
1 parent 9ff691b commit 8c8feff

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

resources/scripts/api/server/files/getFileContents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import http from '@/api/http';
33
export default (server: string, file: string): Promise<string> => {
44
return new Promise((resolve, reject) => {
55
http.get(`/api/client/servers/${server}/files/contents`, {
6-
params: { file },
6+
params: { file: file.split('/').map(item => encodeURIComponent(item)).join('/') },
77
transformResponse: res => res,
88
responseType: 'text',
99
})

resources/scripts/api/server/files/loadDirectory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface FileObject {
1717

1818
export default async (uuid: string, directory?: string): Promise<FileObject[]> => {
1919
const { data } = await http.get(`/api/client/servers/${uuid}/files/list`, {
20-
params: { directory },
20+
params: { directory: directory?.split('/').map(item => encodeURIComponent(item)).join('/') },
2121
});
2222

2323
return (data.data || []).map(rawDataToFileObject);

resources/scripts/plugins/useFileManagerSwr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default () => {
1414
focusThrottleInterval: 30000,
1515
revalidateOnMount: false,
1616
refreshInterval: 0,
17+
errorRetryCount: 2,
1718
},
1819
);
1920
};

0 commit comments

Comments
 (0)