[GH-ISSUE #1782] Error 500 on user creation #1403

Closed
opened 2026-02-27 11:16:55 +03:00 by kerem · 6 comments
Owner

Originally created by @benjaminbellamy on GitHub (Oct 5, 2019).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1782

I don’t know if this is a bug or a hidden feature, but you cannot add new accounts after updating /srv/modoboa/instance/sitestatic/css/modoboa.png

Impacted versions

  • Modoboa: 1.14.0
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

  • Install Modoboa
  • Design a nice logo with Gimp (or MS Paint if you live in 1984 or Photoshop if you love DRMs)
  • Replace /srv/modoboa/instance/sitestatic/css/modoboa.png with your logo.
  • Add a new identity/mailbox and…
  • Patatra !

Current behavior

Error 500

IOError at /admin/accounts/new/
cannot identify image file <open file u'/srv/modoboa/instance/sitestatic/css/modoboa.png', mode 'rb' at 0x7f4171dc9390>
fileName=u'/srv/modoboa/instance/sitestatic/css/modoboa.png' identity=[ImageReader@0x7f4171e5acd0 filename=u'/srv/modoboa/instance/sitestatic/css/modoboa.png']

Request Method: POST
Request URL: https://xxx/admin/accounts/new/
Django Version: 1.11.24
Python Executable: /usr/bin/uwsgi-core
Python Version: 2.7.15
Python Path: ['.', '', '/srv/modoboa/env/lib/python2.7', '/srv/modoboa/env/lib/python2.7/plat-x86_64-linux-gnu', '/srv/modoboa/env/lib/python2.7/lib-tk', '/srv/modoboa/env/lib/python2.7/lib-old', '/srv/modoboa/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/srv/modoboa/env/local/lib/python2.7/site-packages', '/srv/modoboa/env/lib/python2.7/site-packages']
Server time: Sat, 5 Oct 2019 15:54:30 +0200

Expected behavior

Create new account with no Error 500?

Originally created by @benjaminbellamy on GitHub (Oct 5, 2019). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1782 I don’t know if this is a bug or a hidden feature, but you cannot add new accounts after updating `/srv/modoboa/instance/sitestatic/css/modoboa.png` # Impacted versions * Modoboa: 1.14.0 * installer used: Yes * Webserver: Nginx # Steps to reproduce * Install Modoboa * Design a nice logo with Gimp (or MS Paint if you live in 1984 or Photoshop if you love DRMs) * Replace `/srv/modoboa/instance/sitestatic/css/modoboa.png` with your logo. * Add a new identity/mailbox and… * **Patatra !** # Current behavior **Error 500** ``` IOError at /admin/accounts/new/ cannot identify image file <open file u'/srv/modoboa/instance/sitestatic/css/modoboa.png', mode 'rb' at 0x7f4171dc9390> fileName=u'/srv/modoboa/instance/sitestatic/css/modoboa.png' identity=[ImageReader@0x7f4171e5acd0 filename=u'/srv/modoboa/instance/sitestatic/css/modoboa.png'] Request Method: POST Request URL: https://xxx/admin/accounts/new/ Django Version: 1.11.24 Python Executable: /usr/bin/uwsgi-core Python Version: 2.7.15 Python Path: ['.', '', '/srv/modoboa/env/lib/python2.7', '/srv/modoboa/env/lib/python2.7/plat-x86_64-linux-gnu', '/srv/modoboa/env/lib/python2.7/lib-tk', '/srv/modoboa/env/lib/python2.7/lib-old', '/srv/modoboa/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/srv/modoboa/env/local/lib/python2.7/site-packages', '/srv/modoboa/env/lib/python2.7/site-packages'] Server time: Sat, 5 Oct 2019 15:54:30 +0200 ``` # Expected behavior Create new account with no Error 500?
kerem closed this issue 2026-02-27 11:16:56 +03:00
Author
Owner

@tonioo commented on GitHub (Oct 11, 2019):

@benjaminbellamy Are you sure your image is not corrupted? Is it a real PNG file?

<!-- gh-comment-id:541077519 --> @tonioo commented on GitHub (Oct 11, 2019): @benjaminbellamy Are you sure your image is not corrupted? Is it a real PNG file?
Author
Owner

@benjaminbellamy commented on GitHub (Oct 11, 2019):

Yes, the PNG is perfectly displayed, everything works fine. I just can’t create new mailboxes.
And when I put the original PNG file back I can create accounts again.

<!-- gh-comment-id:541143661 --> @benjaminbellamy commented on GitHub (Oct 11, 2019): Yes, the PNG is perfectly displayed, everything works fine. I just can’t create new mailboxes. And when I put the original PNG file back I can create accounts again.
Author
Owner

@tonioo commented on GitHub (Oct 13, 2019):

@benjaminbellamy The error is pretty clear: cannot identify image file <open file u'/srv/modoboa/instance/sitestatic/css/modoboa.png. Your PNG file must be special in some way...

<!-- gh-comment-id:541412629 --> @tonioo commented on GitHub (Oct 13, 2019): @benjaminbellamy The error is pretty clear: ``cannot identify image file <open file u'/srv/modoboa/instance/sitestatic/css/modoboa.png``. Your PNG file must be special in some way...
Author
Owner

@benjaminbellamy commented on GitHub (Oct 15, 2019):

I don’t see anything special about this file. It is displayed fine by Nginx/browser.
I even tried with a blank png file, same size, same error.
Weird.
Why is this happening on user creation? How is user creation related to a PNG file?

<!-- gh-comment-id:542230399 --> @benjaminbellamy commented on GitHub (Oct 15, 2019): I don’t see anything special about this file. It is displayed fine by Nginx/browser. I even tried with a blank png file, same size, same error. Weird. Why is this happening on user creation? How is user creation related to a PNG file?
Author
Owner

@benjaminbellamy commented on GitHub (Oct 15, 2019):

I just got it: the PDF file created with the user credential needs the PNG file.

<!-- gh-comment-id:542233650 --> @benjaminbellamy commented on GitHub (Oct 15, 2019): I just got it: the PDF file created with the user credential needs the PNG file.
Author
Owner

@benjaminbellamy commented on GitHub (Oct 15, 2019):

OK, I found it: PNG file must have NO metadata at all.
I removed them, now it works.

For instance when exporting to PNG using Gimp, you must uncheck all checkboxes (uncheck "Save Exif data"…).
Comments for PIL/Image.py open() function says "This is a lazy operation;"… Well it kinda is lazy…
(I had checked my PNG file header with Hex editor and they were clean.)

<!-- gh-comment-id:542243006 --> @benjaminbellamy commented on GitHub (Oct 15, 2019): OK, I found it: **PNG file must have NO metadata at all.** I removed them, now it works. For instance when exporting to PNG using Gimp, you must uncheck all checkboxes (uncheck `"Save Exif data"`…). Comments for PIL/Image.py open() function says `"This is a lazy operation;"`… Well it kinda is lazy… (I had checked my PNG file header with Hex editor and they were clean.)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1403
No description provided.