From ad355fdc65993a9d39441f86d7d50fc49adcc4c9 Mon Sep 17 00:00:00 2001 From: Masterjun Date: Mon, 11 Aug 2025 23:52:51 +0200 Subject: [PATCH] Fix Content-Length calculation in mhtml generation --- yt_dlp/downloader/mhtml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/downloader/mhtml.py b/yt_dlp/downloader/mhtml.py index 3d4f2d7634..9ad9b3f795 100644 --- a/yt_dlp/downloader/mhtml.py +++ b/yt_dlp/downloader/mhtml.py @@ -133,7 +133,7 @@ def real_download(self, filename, info_dict): '\r\n' f'--{frag_boundary}\r\n' 'Content-Type: text/html; charset=utf-8\r\n' - f'Content-Length: {len(stub)}\r\n' + f'Content-Length: {len(stub.encode())}\r\n' '\r\n' f'{stub}\r\n').encode()) extra_state['header_written'] = True