From 24ffd08b39e069bd8b011486c3c8297570191fc6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 10 Oct 2015 09:19:13 +0530 Subject: [PATCH] ... --- src/calibre/srv/code.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/code.py b/src/calibre/srv/code.py index 6e14398aae..df7aadfe4c 100644 --- a/src/calibre/srv/code.py +++ b/src/calibre/srv/code.py @@ -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)