dont load svg

This commit is contained in:
Green Sky
2026-01-10 13:09:41 +01:00
parent 22823c5ca2
commit bf55561193
3 changed files with 33 additions and 32 deletions

View File

@@ -7,6 +7,7 @@
static std::optional<const char*> getExt(SDL_IOStream* ios) {
// blacklist:
// - svg
// - tga
// - tiff
// - xcf
@@ -33,8 +34,6 @@ static std::optional<const char*> getExt(SDL_IOStream* ios) {
return "png";
} else if (IMG_isPNM(ios)) {
return "pnm";
} else if (IMG_isSVG(ios)) {
return "svg";
} else if (IMG_isXPM(ios)) {
return "xpm";
} else if (IMG_isXV(ios)) {

View File

@@ -50,11 +50,19 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) {
return;
}
if (!o.all_of<ObjComp::F::TagLocalHaveAll>()) {
// not ready yet
return;
}
// TODO: handle collections
const auto file_size = o.get<ObjComp::F::SingleInfo>().file_size;
if (file_size > 50*1024*1024) {
std::cerr << "MMIL error: image file too large\n";
// not an error
//std::cerr << "MMIL error: image file too large\n";
// this is unlikely to change, so we tag as not image
m.emplace<Message::Components::TagNotImage>();
return;
}
@@ -63,18 +71,12 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) {
return;
}
if (!o.all_of<ObjComp::F::TagLocalHaveAll>()) {
// not ready yet
return;
}
auto* file_backend = o.get<ObjComp::Ephemeral::BackendFile2>().ptr;
if (file_backend == nullptr) {
std::cerr << "MMIL error: object backend nullptr\n";
return;
}
auto file2 = file_backend->file2(o, StorageBackendIFile2::FILE2_READ);
if (!file2 || !file2->isGood() || !file2->can_read) {
std::cerr << "MMIL error: creating file2 from object via backendI\n";