Avoid breaking the entire UI when naughty characters are present in the file name or directory; closes #2575

This commit is contained in:
Dane Everitt 2020-10-22 21:18:46 -07:00
parent 65d04d0c05
commit 903b5795db
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 78 additions and 39 deletions

View file

@ -13,6 +13,7 @@ import useFlash from '@/plugins/useFlash';
import useFileManagerSwr from '@/plugins/useFileManagerSwr';
import { WithClassname } from '@/components/types';
import FlashMessageRender from '@/components/FlashMessageRender';
import ErrorBoundary from '@/components/elements/ErrorBoundary';
interface Values {
directoryName: string;
@ -92,9 +93,9 @@ export default ({ className }: WithClassname) => {
<span css={tw`text-neutral-200`}>This directory will be created as</span>
&nbsp;/home/container/
<span css={tw`text-cyan-200`}>
{decodeURIComponent(
join(directory, values.directoryName).replace(/^(\.\.\/|\/)+/, ''),
)}
{decodeURIComponent(encodeURIComponent(
join(directory, values.directoryName).replace(/^(\.\.\/|\/)+/, '')
))}
</span>
</p>
<div css={tw`flex justify-end`}>