ungana

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README

commit 9701373ca7a2a6a8e9bd142ecb70b48808daea77
parent 33aa0836f2606644c416ca7d2d908722716f8844
Author: Carlosokumu <carlosokumu254@gmail.com>
Date:   Wed,  5 Nov 2025 22:07:38 +0300

fix: ensure html contents are read correctly

Diffstat:
Mungana/cmd/args_parser.py | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/ungana/cmd/args_parser.py b/ungana/cmd/args_parser.py @@ -459,7 +459,7 @@ class ArgsParser: contact = value else: contact = None - + for ctx_name in ("poster", "long"): arg_val = getattr(args, ctx_name, None) if arg_val: @@ -469,13 +469,16 @@ class ArgsParser: if not file_path.exists(): self.parser.error(f"{ctx_name} file not found: {file_path}") - if ctx_name == "poster": + try: + if ctx_name == "poster": + data = file_path.read_bytes() + else: + data = file_path.read_text(encoding="utf-8") + except UnicodeDecodeError: data = file_path.read_bytes() - else: - data = file_path.read_text(encoding="utf-8") prop, value, params = self.attachment_manager.create_attachment( - file_path, + file_path, ctx=ctx_name, data=data ) @@ -484,6 +487,7 @@ class ArgsParser: except Exception as e: self.parser.error(f"Unexpected error processing {ctx_name}: {e}") + event_data = { 'summary': args.summary, 'description': args.description,