From d60fb27560de3f9ab83e5380b34ca48e2975e61d Mon Sep 17 00:00:00 2001 From: akleine Date: Mon, 9 Feb 2026 16:59:43 +0100 Subject: [PATCH] fix: avoid unwanted file extension changes (#1257) --- examples/cli/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/cli/main.cpp b/examples/cli/main.cpp index cc382d2..f9e4928 100644 --- a/examples/cli/main.cpp +++ b/examples/cli/main.cpp @@ -394,12 +394,15 @@ bool save_results(const SDCliParams& cli_params, fs::path base_path = out_path; fs::path ext = out_path.has_extension() ? out_path.extension() : fs::path{}; - if (!ext.empty()) - base_path.replace_extension(); std::string ext_lower = ext.string(); std::transform(ext_lower.begin(), ext_lower.end(), ext_lower.begin(), ::tolower); bool is_jpg = (ext_lower == ".jpg" || ext_lower == ".jpeg" || ext_lower == ".jpe"); + if (!ext.empty()) { + if (is_jpg || ext_lower == ".png") { + base_path.replace_extension(); + } + } int output_begin_idx = cli_params.output_begin_idx; if (output_begin_idx < 0) {