Skip to content
Snippets Groups Projects
Commit 3347943d authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

Merge branch 'master' of git.sch.bme.hu:kszk/devteam/kszkepzes/old/kszkepzes-frontend

parents 29483107 0d8a97d9
Branches
Tags 1.1.2
No related merge requests found
......@@ -35,6 +35,16 @@ const allowedFileTypes = [
'application/x-zip',
];
const allowedFileEnds = ['.zip', '.jpeg', '.jpg', '.jpe', '.png'];
function validateFileName(fileNameToValidate) {
return (
allowedFileEnds.find((typeName) => {
return fileNameToValidate.toLowerCase().endsWith(typeName);
}).length > 0
);
}
// in megabytes
const maxFileSize = 50;
......@@ -211,7 +221,7 @@ class AddSolutionForm extends Component {
!description ||
(!file
? false
: !allowedFileTypes.includes(file.type) ||
: !validateFileName(file.name) ||
file.size > maxFileSize * 1024 ** 2)
}
inverted
......@@ -270,7 +280,7 @@ class AddSolutionForm extends Component {
!description ||
(!file
? false
: !allowedFileTypes.includes(file.type) ||
: !validateFileName(file.name) ||
file.size > maxFileSize * 1024 ** 2)
}
onClick={() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment