mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-08 12:35:39 +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)) {
|
if (is_virtual(src)) {
|
||||||
var path = normalize_path(src);
|
var path = normalize_path(src);
|
||||||
const file = retrieve_file(path);
|
const file = retrieve_file(path);
|
||||||
// TODO handle mime type
|
const mime_type = window.global_context.file_tree[path].mime_type;
|
||||||
if (file.startsWith('<svg')) {
|
if (mime_type == 'image/svg+xml') {
|
||||||
img.setAttribute('src', "data:image/svg+xml;charset=utf-8;base64, " + btoa(file));
|
img.setAttribute('src', "data:image/svg+xml;charset=utf-8;base64, " + btoa(file));
|
||||||
} else {
|
} 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