mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
d175bd1647
commit
24ffd08b39
@ -6,17 +6,18 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
print_function)
|
||||
import errno
|
||||
|
||||
from calibre import sanitize_file_name2
|
||||
from calibre.srv.errors import HTTPNotFound
|
||||
from calibre.srv.routes import endpoint
|
||||
|
||||
@endpoint('', auth_required=False)
|
||||
def index(ctx, rd):
|
||||
return open(P('content-server/index.html'), 'rb')
|
||||
return lopen(P('content-server/index.html'), 'rb')
|
||||
|
||||
@endpoint('/js/{which}', auth_required=False)
|
||||
def js(ctx, rd, which):
|
||||
try:
|
||||
return open(P('content-server/' + which), 'rb')
|
||||
return lopen(P('content-server/' + sanitize_file_name2(which)), 'rb')
|
||||
except EnvironmentError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise HTTPNotFound('No js with name: %r' % which)
|
||||
|
Loading…
x
Reference in New Issue
Block a user