Fix bug in file transfer logic

This commit is contained in:
Adrian Vollmer 2024-04-27 19:36:32 +02:00
parent 3eda0fb604
commit 0c594fdc0b
2 changed files with 5 additions and 1 deletions

View File

@ -118,7 +118,7 @@ action: "retrieveFile",
var embedImgFromParent = function(img) {
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));
} else {
img.setAttribute('src', `data:${file.mime_type};base64, ${file.data}`);

View File

@ -63,6 +63,10 @@ var normalizePath = function(path) {
var result = window.globalContext.current_path;
result = result.split('/');
result.pop();
// path can be a request object
if (!(typeof path === 'string' || path instanceof String)) {
path = path.href;
};
result = result.concat(path.split('/'));
// resolve relative directories