emencia / django-blog-lotus

A weblog application with Django.
https://django-blog-lotus.readthedocs.io/
MIT License
5 stars 1 forks source link

SVG support #39

Closed sveetch closed 1 year ago

sveetch commented 1 year ago

Describe the bug Trying to upload a SVG file in any image field in an article or category return a form validation error:

Upload a valid image. The file you uploaded was either not an image or a corrupted image.

Despite the SVG created from Demo are properly saved and working on frontend.

Environment Describe your environment:

However this should be an issue on any plateform, Python and Django versions.

To Reproduce Steps to reproduce the behavior:

  1. Go to the create/edit form for Article or Category
  2. Fill required fields and at least one image field with a SVG file
  3. Submit form
  4. Form validation return an error

Expected behavior SVG file support was thought to be ok since the demo create some ones. But SVG does not seems to be explicitely tested on model, however the model itself may not perform any validation, it may be only done from form validator (this is something to ensure). And so this issue was hided until some front tests have been done.

So finally the expected behavior is that we should be able to upload SVG files.

This is a well known problem that ImageField does not support SVG since it validate file with PIL. A workaround is to use FileField instead with a basic file extension/mime validator to reject non image files.

Implementation of smart image management from #11 should resolve this since it was its first purpose.

sveetch commented 1 year ago

This issue has been resolved with implementation of django-smart-media