docker-calibre-web
docker-calibre-web copied to clipboard
Cannot upload files
docker create
docker create --name=calibre-web --restart=no \
-v `pwd`/data/books:/books \
-v `pwd`/data/app:/calibre-web/app \
-v `pwd`/data/kindlegen:/calibre-web/kindlegen \
-v `pwd`/data/config:/calibre-web/config \
-v /etc/localtime:/etc/localtime:ro \
-e PGID=`id -g` \
-e PUID=`id -u` \
-p 8083:8083 \
"${IMAGE}"
Problem
- enable uploads
- get example PDF: https://owasp.org/www-pdf-archive/SAMM_Core_V1-5_FINAL.pdf
- upload the PDF
- get the error in the log:
[2020-10-14 16:27:20,215] ERROR {cps.helper:394} Rename title from: /tmp/calibre_web/6f87bab46d6794406c7a9ddb932ab1e1 to /books/Unknown/Software Assurance Maturity Model (SAMM) (3): [Errno 18] Cross-device link
[2020-10-14 16:27:20,216] ERROR {cps:1892} Exception on /upload [POST]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/calibre-web/app/cps/web.py", line 202, in decorated_view
return login_required(func)(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/flask_login/utils.py", line 272, in decorated_view
return func(*args, **kwargs)
File "/calibre-web/app/cps/web.py", line 273, in inner
return f(*args, **kwargs)
File "/calibre-web/app/cps/editbooks.py", line 874, in upload
copyfile(coverfile, new_coverpath)
File "/usr/lib/python2.7/shutil.py", line 97, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 2] No such file or directory: u'/books/Unknown/Software Assurance Maturity Model (SAMM)/cover.jpg'
Here is the log with debug enabled:
[2020-10-14 16:45:19,537] DEBUG {cps.uploader:208} Temporary file: /tmp/calibre_web/6f87bab46d6794406c7a9ddb932ab1e1
[2020-10-14 16:45:54,937] ERROR {cps.helper:394} Rename title from: /tmp/calibre_web/6f87bab46d6794406c7a9ddb932ab1e1 to /books/Unknown/Software Assurance Maturity Model (SAMM) (4): [Errno 18] Cross-device link
[2020-10-14 16:45:54,937] DEBUG {cps.helper:395} [Errno 18] Cross-device link
Traceback (most recent call last):
File "/calibre-web/app/cps/helper.py", line 377, in update_dir_structure_file
os.path.normcase(os.path.join(new_path, db_filename)))
File "/usr/lib/python2.7/os.py", line 199, in renames
rename(old, new)
OSError: [Errno 18] Cross-device link
[2020-10-14 16:45:54,938] ERROR {cps:1892} Exception on /upload [POST]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/calibre-web/app/cps/web.py", line 202, in decorated_view
return login_required(func)(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/flask_login/utils.py", line 272, in decorated_view
return func(*args, **kwargs)
File "/calibre-web/app/cps/web.py", line 273, in inner
return f(*args, **kwargs)
File "/calibre-web/app/cps/editbooks.py", line 874, in upload
copyfile(coverfile, new_coverpath)
File "/usr/lib/python2.7/shutil.py", line 97, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 2] No such file or directory: u'/books/Unknown/Software Assurance Maturity Model (SAMM)/cover.jpg'
Added -v
pwd/data/tmp:/tmp \
to docker create
, still get the same error.
Tested now with the last version 1.5.0 - Calibre Web 0.6.10 Beta:
I get after upload the following message on the web interface
<html> <head><title>405 Not Allowed</title></head> <body> <center><h1>405 Not Allowed</h1>
and in calibre-web.log
I get
[2020-10-24 15:02:11,393] ERROR {cps.helper:394} Rename title from: /tmp/calibre_web/6f87bab46d6794406c7a9ddb932ab1e1 to /books/Unknown/Software Assurance Maturity Model (SAMM) (257): [Errno 18] Cross-device link: '/tmp/calibre_web/6f87bab46d6794406c7a9ddb932ab1e1' -> '/books/Unknown/Software Assurance Maturity Model (SAMM) (257)/Software Assurance Maturity Model (SAMM).pdf'
[2020-10-24 15:02:11,394] ERROR {cps.editbooks:878} Failed to move cover file /books/Unknown/Software Assurance Maturity Model (SAMM)/cover.jpg: [Errno 2] No such file or directory: '/books/Unknown/Software Assurance Maturity Model (SAMM)/cover.jpg'
Used the update button on the Calibre Web interface to update to the last stable version
0.6.9 | Current version |
---|
and get the same issue as with Calibre Web 0.6.10 Beta.
Btw. other files works without any problem like the attached one: 20000-Leagues-Under-the-Sea.pdf
This seems to be an issue of the Calibre-Web application especially with this file itself and is not an issue of the docker container.
@janeczku could you please have a look on this, thanks :)
@Technosoft2000 I just read this post. janeczku isn't actively involed in the development of calibre-web. I had a look at it. The problem should be solved. The reason as that for long time calibre-web used a rename function to move files from one location to another. This works fine as long as the files are on the same drive, for moving the files to another drive this function call fails. So it has nothing to do with the file itself, but with the location of tmp dir and calibre databse dir. It should work by now (at least for me it does, without docker)
but with the location of tmp dir and calibre databse dir....
Thanks for that hint @OzzieIsaacs - I'll check it.