Edit book: Fix editing of JavaScript files not working. Fixes #1915770 [editor creates mal-formed .js files](https://bugs.launchpad.net/calibre/+bug/1915770)

This commit is contained in:
Kovid Goyal 2021-02-16 08:38:29 +05:30
parent 52d048ece3
commit fd77db2da5
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -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: