Skip to content

Commit b30d742

Browse files
committed
Decode the filename when rendering it to the screen; closes pterodactyl#2101
1 parent 050fe30 commit b30d742

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

resources/scripts/components/server/files/FileManagerBreadcrumbs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ export default ({ withinFileEditor, isNewFile }: Props) => {
2525
.filter(directory => !!directory)
2626
.map((directory, index, dirs) => {
2727
if (!withinFileEditor && index === dirs.length - 1) {
28-
return { name: directory };
28+
return { name: decodeURIComponent(directory) };
2929
}
3030

31-
return { name: directory, path: `/${dirs.slice(0, index + 1).join('/')}` };
31+
return { name: decodeURIComponent(directory), path: `/${dirs.slice(0, index + 1).join('/')}` };
3232
});
3333

3434
return (
@@ -57,7 +57,7 @@ export default ({ withinFileEditor, isNewFile }: Props) => {
5757
}
5858
{file &&
5959
<React.Fragment>
60-
<span className={'px-1 text-neutral-300'}>{file}</span>
60+
<span className={'px-1 text-neutral-300'}>{decodeURIComponent(file)}</span>
6161
</React.Fragment>
6262
}
6363
</div>

resources/scripts/components/server/files/NewDirectoryButton.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ export default () => {
7070
/>
7171
<p className={'text-xs mt-2 text-neutral-400'}>
7272
<span className={'text-neutral-200'}>This directory will be created as</span>
73-
&nbsp;/home/container/<span className={'text-cyan-200'}>{join(directory, values.directoryName).replace(/^(\.\.\/|\/)+/, '')}</span>
73+
&nbsp;/home/container/
74+
<span className={'text-cyan-200'}>
75+
{decodeURIComponent(
76+
join(directory, values.directoryName).replace(/^(\.\.\/|\/)+/, ''),
77+
)}
78+
</span>
7479
</p>
7580
<div className={'flex justify-end'}>
7681
<button className={'btn btn-sm btn-primary mt-8'}>

resources/scripts/state/server/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const files: ServerFileStore = {
4848
}),
4949

5050
setDirectory: action((state, payload) => {
51-
state.directory = cleanDirectoryPath(payload)
51+
state.directory = cleanDirectoryPath(payload);
5252
}),
5353
};
5454

0 commit comments

Comments
 (0)