mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
fix(TLS): remove file type validation [EE-3672] (#7280)
This commit is contained in:
parent
985eef6987
commit
b040aa1e78
2 changed files with 2 additions and 32 deletions
|
@ -1,10 +1,6 @@
|
|||
import { useFormikContext } from 'formik';
|
||||
|
||||
import {
|
||||
file,
|
||||
withFileSize,
|
||||
withFileType,
|
||||
} from '@/portainer/helpers/yup-file-validation';
|
||||
import { file, withFileSize } from '@/portainer/helpers/yup-file-validation';
|
||||
|
||||
import { FileUploadField } from '@@/form-components/FileUpload';
|
||||
import { SwitchField } from '@@/form-components/SwitchField';
|
||||
|
@ -83,16 +79,9 @@ export function TLSFieldset() {
|
|||
}
|
||||
|
||||
const MAX_FILE_SIZE = 5_242_880; // 5MB
|
||||
const ALLOWED_FILE_TYPES = [
|
||||
'application/x-x509-ca-cert',
|
||||
'application/x-pem-file',
|
||||
];
|
||||
|
||||
function certValidation() {
|
||||
return withFileType(
|
||||
withFileSize(file(), MAX_FILE_SIZE),
|
||||
ALLOWED_FILE_TYPES
|
||||
).when(['tls', 'skipVerify'], {
|
||||
return withFileSize(file(), MAX_FILE_SIZE).when(['tls', 'skipVerify'], {
|
||||
is: (tls: boolean, skipVerify: boolean) => tls && !skipVerify,
|
||||
then: (schema) => schema.required('File is required'),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue