Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 on Book Upload [a bytes-like object is required, not 'str'] #2302

Closed
BoostWillis opened this issue Feb 1, 2022 · 8 comments
Closed

500 on Book Upload [a bytes-like object is required, not 'str'] #2302

BoostWillis opened this issue Feb 1, 2022 · 8 comments
Labels

Comments

@BoostWillis
Copy link

BoostWillis commented Feb 1, 2022

Describe the bug/problem
Attempting to upload a 1.5mb PDF book results in an Internal Server Error

To Reproduce
Steps to reproduce the behavior:

  1. Click upload button
  2. Select Book
  3. Wait for upload to complete
  4. Receive error

Logfile

[2022-02-01 18:07:04,014] ERROR {cps:1458} Exception on /upload [POST]
Traceback (most recent call last):
  File "/var/www/calibreweb/vendor/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/var/www/calibreweb/vendor/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/var/www/calibreweb/vendor/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/var/www/calibreweb/vendor/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/var/www/calibreweb/cps/usermanagement.py", line 38, in decorated_view
    return login_required(func)(*args, **kwargs)
  File "/var/www/calibreweb/vendor/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/var/www/calibreweb/cps/editbooks.py", line 71, in inner
    return f(*args, **kwargs)
  File "/var/www/calibreweb/cps/editbooks.py", line 1028, in upload
    db_book, input_authors, title_dir = create_book_on_upload(modif_date, meta)
  File "/var/www/calibreweb/cps/editbooks.py", line 950, in create_book_on_upload
    modif_date |= edit_book_tags(meta.tags, db_book)
  File "/var/www/calibreweb/cps/editbooks.py", line 437, in edit_book_tags
    input_tags = tags.split(',')
TypeError: a bytes-like object is required, not 'str'

Add content of calibre-web.log file or the relevant error, try to reproduce your problem with "debug" log-level to get more output.

Expected behavior
Book to be uploaded without error.

Screenshots
n/a

Environment (please complete the following information):

  • OS: Debian running the latest YunoHost 4.3.6.2
  • Python version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
  • Calibre-Web version: 0.6.14 - 4da64ce - 2021-10-31T11:31:53+01:00
  • Docker container: None:
  • Special Hardware: Just a regular x86_64 linode VPS running Debian Yunohost.
  • Browser: Firefox 96

** Attempted Resolutions
Updated all packages.
Restarted the calibre-web service.
Restarted the server.

Additional context
Yunohost runs a reverse proxy
Special database location: /home/yunohost.multimedia/share/eBook
LDAP users

@OzzieIsaacs
Copy link
Collaborator

Meanwhile calibre-Web itself is on version 0.6.16. Yunohost needs to update its calibre-Web version

@BoostWillis
Copy link
Author

That seems to be in progress currently: YunoHost-Apps/calibreweb_ynh#93

Was this a known issue in previous versions?

Update: This particular book uploads just fine after being converted to EPUB from PDF.

@OzzieIsaacs
Copy link
Collaborator

I can‘t remember. To check if it still happens with current version I would need the book (preferably per email, the one on my GitHub profile page)

@OzzieIsaacs
Copy link
Collaborator

Or you just wait a few days

@OzzieIsaacs OzzieIsaacs added the bug label Feb 1, 2022
@OzzieIsaacs
Copy link
Collaborator

OzzieIsaacs commented Feb 1, 2022

It's causing the same error in 0.6.16

@OzzieIsaacs
Copy link
Collaborator

OzzieIsaacs commented Feb 1, 2022

It's fixed, but it will be published on yunohost with version 0.6.17 (yet to come). The workaround is to add this book via calibre desktop app to the library. I never had a case like this, so I think it's not very common and almost all other books should work

@OzzieIsaacs OzzieIsaacs reopened this Feb 1, 2022
@OzzieIsaacs
Copy link
Collaborator

Updated the last comment

@BoostWillis
Copy link
Author

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants