mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-06 11:35:40 +00:00
Properly handle mime type in embed_img
This commit is contained in:
parent
4088f251e3
commit
ad4f3c838c
@ -110,11 +110,11 @@ var embed_img = function(img) {
|
||||
if (is_virtual(src)) {
|
||||
var path = normalize_path(src);
|
||||
const file = retrieve_file(path);
|
||||
// TODO handle mime type
|
||||
if (file.startsWith('<svg')) {
|
||||
const mime_type = window.global_context.file_tree[path].mime_type;
|
||||
if (mime_type == 'image/svg+xml') {
|
||||
img.setAttribute('src', "data:image/svg+xml;charset=utf-8;base64, " + btoa(file));
|
||||
} else {
|
||||
img.setAttribute('src', "data:image/png;base64, " + file);
|
||||
img.setAttribute('src', `data:${mime_type};base64, ${file}`);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user