mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-23 01:22:30 +01:00
Fix file creation in nested directory
This commit is contained in:
parent
a1a344bc48
commit
3e915e526b
@ -46,7 +46,7 @@ export default () => {
|
||||
})
|
||||
.then(() => {
|
||||
if (name) {
|
||||
history.push(`/server/${id}/files/edit#${hash.replace(/^#/, '')}/${name}`);
|
||||
history.push(`/server/${id}/files/edit#/${name}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ import Modal, { RequiredModalProps } from '@/components/elements/Modal';
|
||||
import { Form, Formik, FormikActions } from 'formik';
|
||||
import { object, string } from 'yup';
|
||||
import Field from '@/components/elements/Field';
|
||||
import { ServerContext } from '@/state/server';
|
||||
import { join } from 'path';
|
||||
|
||||
type Props = RequiredModalProps & {
|
||||
onFileNamed: (name: string) => void;
|
||||
@ -13,8 +15,10 @@ interface Values {
|
||||
}
|
||||
|
||||
export default ({ onFileNamed, onDismissed, ...props }: Props) => {
|
||||
const directory = ServerContext.useStoreState(state => state.files.directory);
|
||||
|
||||
const submit = (values: Values, { setSubmitting }: FormikActions<Values>) => {
|
||||
onFileNamed(values.fileName);
|
||||
onFileNamed(join(directory, values.fileName));
|
||||
setSubmitting(false);
|
||||
};
|
||||
|
||||
@ -40,6 +44,7 @@ export default ({ onFileNamed, onDismissed, ...props }: Props) => {
|
||||
name={'fileName'}
|
||||
label={'File Name'}
|
||||
description={'Enter the name that this file should be saved as.'}
|
||||
autoFocus={true}
|
||||
/>
|
||||
<div className={'mt-6 text-right'}>
|
||||
<button className={'btn btn-primary btn-sm'}>
|
||||
|
Loading…
Reference in New Issue
Block a user