FIX: big thumbnail send by multi-frame

Change-Id: Ia3a88fb53b8cc27d20fa976822c91c09b4442d71
This commit is contained in:
chunmao.guo 2023-07-07 18:31:03 +08:00 committed by Lane.Wei
parent 86a7de4557
commit fefd13a4ac

View file

@ -842,7 +842,7 @@ void PrinterFileSystem::UpdateFocusThumbnail2(std::shared_ptr<std::vector<File>>
file.path = path; file.path = path;
return FILE_SIZE_ERR; return FILE_SIZE_ERR;
} }
auto n = file.path.find_last_of('#'); auto n = path.find_last_of('#');
auto path2 = n == std::string::npos ? path : path.substr(0, n); auto path2 = n == std::string::npos ? path : path.substr(0, n);
auto iter = std::find_if(files->begin(), files->end(), [&path2](auto &f) { return f.path == path2; }); auto iter = std::find_if(files->begin(), files->end(), [&path2](auto &f) { return f.path == path2; });
if (cont) { if (cont) {
@ -868,6 +868,9 @@ void PrinterFileSystem::UpdateFocusThumbnail2(std::shared_ptr<std::vector<File>>
wxMemoryInputStream mis(data, size); wxMemoryInputStream mis(data, size);
mimetype.Replace("jpg", "jpeg"); mimetype.Replace("jpg", "jpeg");
file.thumbnail = wxImage(mis, mimetype); file.thumbnail = wxImage(mis, mimetype);
if (!file.thumbnail.IsOk()) {
BOOST_LOG_TRIVIAL(info) << "PrinterFileSystem: parse thumbnail failed" << size << mimetype;
}
} }
file.name = thumbnail; file.name = thumbnail;
file.path = path; file.path = path;