diff --git a/src/rp2_common/pico_lwip/tools/makefsdata.py b/src/rp2_common/pico_lwip/tools/makefsdata.py index 9ee0d88c1..e50c898c5 100755 --- a/src/rp2_common/pico_lwip/tools/makefsdata.py +++ b/src/rp2_common/pico_lwip/tools/makefsdata.py @@ -19,7 +19,7 @@ def process_file(input_dir, file): results = [] # Check content type - content_type, _ = mimetypes.guess_type(file) + content_type, content_encoding = mimetypes.guess_type(file) if content_type is None: content_type = "application/octet-stream" @@ -53,9 +53,15 @@ def process_file(input_dir, file): comment = f"\"Content-Length: {file_size}\" ({len(data)} chars)" results.append({'data': bytes(data, "utf-8"), 'comment': comment}); - # content type - data = f"Content-Type: {content_type}\r\n\r\n" - comment = f"\"Content-Type: {content_type}\" ({len(data)} chars)" + # content type and content encoding + content_type_header = f"Content-Type: {content_type}" + if content_encoding is None: + data = f"{content_type_header}\r\n\r\n" + comment = f"\"{content_type_header}\" ({len(data)} chars)" + else: + content_encoding_header = f"Content-Encoding: {content_encoding}" + data = f"{content_type_header}\r\n{content_encoding_header}\r\n\r\n" + comment = f"\"{content_type_header} {content_encoding_header}\" ({len(data)} chars)" results.append({'data': bytes(data, "utf-8"), 'comment': comment}); # file contents