i am working on a large project and i have this very simple image viewer:
import { invoke } from "@tauri-apps/api";
import { useState } from "react";
export default function image_viewer(file_selected: string | null){
const [image, set_image] = useState("");
let update = async () => {
// all of these lines do exactly what you think.
// i don't think it's neccesery to add the rust side, since this doesn't
// affect the issue
if (file_selected == null) {return;}
let name: string = await invoke('system_get', {key: 'name'});
let password: string = await invoke('system_get', {key: 'password'});
let bytes: string = await invoke('read_file', {name, password,file: file_selected});
if (bytes == null) {return;}
set_image(bytes);
}
let html = <div className="outer">
<img className="inner" src={image}>
</img>
</div>
return {html, update};
}
when the image is too large, it returns "[image bytes] (header too large)". tauri also links to https://www.cve.org/CVERecord?id=CVE-2018-12121 for the reason why this happens, but i'm not sure how can i fix this issue, since as far as i know, either set_image or the <img> tag are causing this issue, and neither of them can be removed from this code. how can i fix this issue?