mirror of
https://github.com/frappe/lms.git
synced 2026-04-28 11:39:27 +03:00
Merge pull request #2135 from pateljannat/issues-197
fix: assignment upload issue
This commit is contained in:
@@ -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)"
|
||||
>
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user