From fd77db2da548ebea57b15a5d10e2d57d64e4b1af Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Feb 2021 08:38:29 +0530 Subject: [PATCH] Edit book: Fix editing of JavaScript files not working. Fixes #1915770 [editor creates mal-formed .js files](https://bugs.launchpad.net/calibre/+bug/1915770) --- src/calibre/gui2/tweak_book/boss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index d18c2b2d01..dd7bc62a37 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1612,7 +1612,7 @@ def edit_file(self, name, syntax=None, use_template=None): syntax = syntax or syntax_from_mime(name, guess_type(name)) if use_template is None: data = current_container().raw_data(name) - if isbytestring(data) and syntax in {'html', 'css', 'text', 'xml'}: + if isbytestring(data) and syntax in {'html', 'css', 'text', 'xml', 'javascript'}: try: data = data.decode('utf-8') except UnicodeDecodeError: