mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-03-16 21:40:24 +00:00
Corrupted image upload exception
This commit is contained in:
parent
8f140679aa
commit
9dba8c0abd
3 changed files with 14 additions and 9 deletions
|
|
@ -327,6 +327,10 @@ $('.markdownx').on('markdownx.update', function(e, response) {
|
|||
|
||||
# Changelog
|
||||
|
||||
###### v1.6.3
|
||||
|
||||
* Corrupted image upload exception
|
||||
|
||||
###### v1.6.2
|
||||
|
||||
* Runtest template fix
|
||||
|
|
|
|||
|
|
@ -42,12 +42,13 @@ class ImageForm(forms.Form):
|
|||
return filename
|
||||
|
||||
def clean(self):
|
||||
upload = self.cleaned_data['image']
|
||||
content_type = upload.content_type
|
||||
if content_type in MARKDOWNX_UPLOAD_CONTENT_TYPES:
|
||||
if upload._size > MARKDOWNX_UPLOAD_MAX_SIZE:
|
||||
raise forms.ValidationError(_('Please keep filesize under %(max)s. Current filesize %(current)s') % {'max':filters.filesizeformat(MARKDOWNX_UPLOAD_MAX_SIZE), 'current':filters.filesizeformat(upload._size)})
|
||||
else:
|
||||
raise forms.ValidationError(_('File type is not supported'))
|
||||
upload = self.cleaned_data.get('image')
|
||||
if upload:
|
||||
content_type = upload.content_type
|
||||
if content_type in MARKDOWNX_UPLOAD_CONTENT_TYPES:
|
||||
if upload._size > MARKDOWNX_UPLOAD_MAX_SIZE:
|
||||
raise forms.ValidationError(_('Please keep filesize under %(max)s. Current filesize %(current)s') % {'max':filters.filesizeformat(MARKDOWNX_UPLOAD_MAX_SIZE), 'current':filters.filesizeformat(upload._size)})
|
||||
else:
|
||||
raise forms.ValidationError(_('File type is not supported'))
|
||||
|
||||
return upload
|
||||
return upload
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -10,7 +10,7 @@ def get_requirements():
|
|||
|
||||
setup(
|
||||
name='django-markdownx',
|
||||
version='1.6.2',
|
||||
version='1.6.3',
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
description='django-markdownx is a Markdown editor built for Django.',
|
||||
|
|
|
|||
Loading…
Reference in a new issue