mirror of
https://github.com/wekan/wekan.git
synced 2025-12-24 11:20:13 +01:00
Ref: pass through image size error message (correctly)
This commit is contained in:
parent
545fe96c30
commit
1b591dcda9
2 changed files with 5 additions and 4 deletions
|
|
@ -236,8 +236,7 @@ BlazeComponent.extendComponent({
|
|||
}
|
||||
});
|
||||
uploader.on('error', (error, fileData) => {
|
||||
// XXX check for actually returned error
|
||||
self.setError('avatar-too-big');
|
||||
self.setError(error.reason);
|
||||
});
|
||||
uploader.start();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,10 @@ Avatars = new FilesCollection({
|
|||
collectionName: 'avatars',
|
||||
allowClientCode: true,
|
||||
onBeforeUpload(file) {
|
||||
if (file.size <= 72000 && file.isImage) return true;
|
||||
return 'Please upload image, with size equal or less than 72KB';
|
||||
if (file.size <= 72000 && file.type.startsWith("image/")) {
|
||||
return true;
|
||||
};
|
||||
return 'avatar-too-big';
|
||||
},
|
||||
onAfterUpload: createOnAfterUpload(avatarsBucket),
|
||||
interceptDownload: createInterceptDownload(avatarsBucket),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue