mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-06 19:45:27 +00:00
Fix bug in file transfer logic
This commit is contained in:
parent
3eda0fb604
commit
0c594fdc0b
@ -118,7 +118,7 @@ action: "retrieveFile",
|
|||||||
|
|
||||||
var embedImgFromParent = function(img) {
|
var embedImgFromParent = function(img) {
|
||||||
function setSrc(img, file) {
|
function setSrc(img, file) {
|
||||||
if (mime_type == 'image/svg+xml') {
|
if (file.mime_type == 'image/svg+xml') {
|
||||||
img.setAttribute('src', "data:image/svg+xml;charset=utf-8;base64, " + btoa(file.data));
|
img.setAttribute('src', "data:image/svg+xml;charset=utf-8;base64, " + btoa(file.data));
|
||||||
} else {
|
} else {
|
||||||
img.setAttribute('src', `data:${file.mime_type};base64, ${file.data}`);
|
img.setAttribute('src', `data:${file.mime_type};base64, ${file.data}`);
|
||||||
|
@ -63,6 +63,10 @@ var normalizePath = function(path) {
|
|||||||
var result = window.globalContext.current_path;
|
var result = window.globalContext.current_path;
|
||||||
result = result.split('/');
|
result = result.split('/');
|
||||||
result.pop();
|
result.pop();
|
||||||
|
// path can be a request object
|
||||||
|
if (!(typeof path === 'string' || path instanceof String)) {
|
||||||
|
path = path.href;
|
||||||
|
};
|
||||||
result = result.concat(path.split('/'));
|
result = result.concat(path.split('/'));
|
||||||
|
|
||||||
// resolve relative directories
|
// resolve relative directories
|
||||||
|
Loading…
x
Reference in New Issue
Block a user