Merge pull request #2135 from pateljannat/issues-197

fix: assignment upload issue
This commit is contained in:
Jannat Patel
2026-02-26 12:12:45 +05:30
committed by GitHub
2 changed files with 10 additions and 11 deletions
+2 -1
View File
@@ -83,7 +83,8 @@
private: true,
}"
:validateFile="
(file) => validateFile(file, assignment.data.type.toLowerCase())
(file) =>
validateFile(file, true, assignment.data.type.toLowerCase())
"
@success="(file) => saveSubmission(file)"
>
+8 -10
View File
@@ -650,21 +650,19 @@ export const validateFile = async (
console.error(msg)
return msg
}
if (!file.type.startsWith(`${fileType}/`)) {
return error(__('Only {0} file is allowed.').format(fileType))
}
if (fileType == 'pdf' && extension !== 'pdf') {
if (fileType == 'pdf' && extension != 'pdf') {
return error(__('Only PDF files are allowed.'))
}
if (fileType == 'document' && !['doc', 'docx'].includes(extension)) {
} else if (fileType == 'document' && !['doc', 'docx'].includes(extension)) {
return error(
__('Only document file of type .doc or .docx are allowed.')
)
}
if (file.type === 'image/svg+xml') {
} else if (
['image', 'video'].includes(fileType) &&
!file.type.startsWith(`${fileType}/`)
) {
return error(__('Only {0} file is allowed.').format(fileType))
} else if (file.type === 'image/svg+xml') {
const text = await file.text()
const blacklist = [