Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions dist/doboard-widget-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13827,6 +13827,8 @@ class FileUploader {
let bgColor = window.getComputedStyle(document.body).backgroundColor;
if (bgColor === 'rgba(0, 0, 0, 0)' || bgColor === 'transparent') bgColor = '#ffffff';

const currentOrigin = window.location.origin;

try {
const domtoimageLib = await this.loadDomToImage();
if (domtoimageLib) {
Expand All @@ -13840,7 +13842,25 @@ class FileUploader {
},
filter: (node) => {
if (node.classList && node.classList.contains('doboard_task_widget')) return false;
if (node.tagName === 'NOSCRIPT') return false;
if (node.tagName === 'NOSCRIPT' || node.tagName === 'IFRAME') return false;

if (node.tagName === 'IMG' && node.src && node.src.startsWith('http')) {
try {
const url = new URL(node.src);
if (url.origin !== currentOrigin && !node.crossOrigin) return false;
} catch (e) {
return false;
}
}

if (node.tagName === 'LINK' && node.rel === 'stylesheet') {
try {
if (node.sheet && !node.sheet.cssRules) return false;
} catch (e) {
return false;
}
}

return true;
}
});
Expand Down Expand Up @@ -13869,7 +13889,6 @@ class FileUploader {
windowWidth: document.documentElement.offsetWidth,
windowHeight: document.documentElement.offsetHeight,
onclone: (clonedDoc) => {
const currentOrigin = window.location.origin;
const transparentPixel = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';

clonedDoc.querySelectorAll('img').forEach(img => {
Expand Down
2 changes: 1 addition & 1 deletion dist/doboard-widget-bundle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/doboard-widget-bundle.min.js.map

Large diffs are not rendered by default.

23 changes: 21 additions & 2 deletions js/src/fileuploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ class FileUploader {
let bgColor = window.getComputedStyle(document.body).backgroundColor;
if (bgColor === 'rgba(0, 0, 0, 0)' || bgColor === 'transparent') bgColor = '#ffffff';

const currentOrigin = window.location.origin;

try {
const domtoimageLib = await this.loadDomToImage();
if (domtoimageLib) {
Expand All @@ -443,7 +445,25 @@ class FileUploader {
},
filter: (node) => {
if (node.classList && node.classList.contains('doboard_task_widget')) return false;
if (node.tagName === 'NOSCRIPT') return false;
if (node.tagName === 'NOSCRIPT' || node.tagName === 'IFRAME') return false;

if (node.tagName === 'IMG' && node.src && node.src.startsWith('http')) {
try {
const url = new URL(node.src);
if (url.origin !== currentOrigin && !node.crossOrigin) return false;
Comment on lines +450 to +453
} catch (e) {
return false;
}
}

if (node.tagName === 'LINK' && node.rel === 'stylesheet') {
try {
if (node.sheet && !node.sheet.cssRules) return false;
} catch (e) {
return false;
}
}

return true;
}
});
Expand Down Expand Up @@ -472,7 +492,6 @@ class FileUploader {
windowWidth: document.documentElement.offsetWidth,
windowHeight: document.documentElement.offsetHeight,
onclone: (clonedDoc) => {
const currentOrigin = window.location.origin;
const transparentPixel = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';

clonedDoc.querySelectorAll('img').forEach(img => {
Expand Down