janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.92k stars 1.38k forks source link

Server 500 error on EDIT USERS page #3190

Open MattMulhern opened 6 days ago

MattMulhern commented 6 days ago

Describe the bug/problem

Clicking on 'Edit Users' throes an exception

To Reproduce

Steps to reproduce the behavior:

  1. Go to admin settings
  2. Click on the 'EDIT USERS' button
  3. 500 server error page should be shown

Logfile

[2024-10-20 17:21:10,859] DEBUG {cps.updater:331} Stable version: {'version': '0.6.23'}
[2024-10-20 17:22:05,176] ERROR {cps:838} Exception on /admin/usertable [GET]
Traceback (most recent call last):
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/app/calibre-web/cps/usermanagement.py", line 111, in decorated_view
    return login_required(func)(*args, **kwargs)
  File "/app/calibre-web/cps/cw_login/utils.py", line 296, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
  File "/app/calibre-web/cps/admin.py", line 98, in inner
    return f(*args, **kwargs)
  File "/app/calibre-web/cps/admin.py", line 308, in edit_user_table
    custom_values = calibre_db.session.query(db.cc_classes[config.config_restricted_column]).all()

Expected behavior

the edit users web page should be available.

Screenshots

image

Environment (please complete the following information):

OzzieIsaacs commented 3 days ago

The problem is related to custom columns in the calibre library and the "View Restrictions based on Calibre column" setting.What I would need to figure out the problem:

A1) Content of "View Restrictions based on Calibre column" (maybe editing the value, save and change it back will solve the problem for you, but not for anybody else) or A2) The app.db file (private email from my profile page)

+ (additionally!!!)

B1) A screenshot of the add custom columns screen from calibre: grafik or B2) The content of the custom_column table from the metadata.db file you are using (some sqlite brwoser will show the content)-> my 2 screenshots are from different libraries: grafik or B3): The metadata.db file (private email from my profile page)

MattMulhern commented 2 days ago

I've sent you the app.db and metadata.db files via email now.

So I checked custom columns in my calibre instance and added a new custom column and deleted it again (this is all before sending you the files) and the issue has disappeared.

I've no idea why that would have fixed this for me apologies, but if you want to close off the issue I don't mind :)

OzzieIsaacs commented 6 hours ago

I could reproduce the issue. The only thing I can imagine is the following:

In calibre-web there were checks missing to detect this case, in the newest nightly version a warning message is now displayed.

Thanks for reporting