From 23ab8cc08d2d6281ef56c184f1e1e905e70a2a22 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 8 Aug 2021 10:48:55 +0200 Subject: Matrix: fix thumbnail upload of small thumbnails, fix small thumbnail creation if webp --- src/FileAnalyzer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/FileAnalyzer.cpp') diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp index a24906f..f1f9369 100644 --- a/src/FileAnalyzer.cpp +++ b/src/FileAnalyzer.cpp @@ -137,13 +137,12 @@ namespace QuickMedia { if(width > 0 && height > 0) { FileAnalyzer file_analyzer; - if(file_analyzer.load_file(destination_path_tmp.data.c_str(), false) && create_thumbnail(destination_path_tmp, destination_path, sf::Vector2i(width, height), file_analyzer.get_content_type())) { - remove(destination_path_tmp.data.c_str()); - return true; - } + const bool success = file_analyzer.load_file(destination_path_tmp.data.c_str(), false) && create_thumbnail(destination_path_tmp, destination_path, sf::Vector2i(width, height), file_analyzer.get_content_type(), false); + remove(destination_path_tmp.data.c_str()); + return success; + } else { + return rename_atomic(destination_path_tmp.data.c_str(), destination_path) == 0; } - - return rename_atomic(destination_path_tmp.data.c_str(), destination_path) == 0; } // TODO: Remove dependency on ffprobe @@ -221,6 +220,7 @@ namespace QuickMedia { duration_seconds = std::nullopt; struct stat stat; + memset(&stat, 0, sizeof(stat)); if(fstat(fileno(file), &stat) == -1) { perror(filepath); fclose(file); -- cgit v1.2.3