fileuploader fixed - #122
Merged
Merged
Conversation
Copilot started reviewing on behalf of
veronika-tseleva-cleantalk
August 21, 2026 10:58
View session
There was a problem hiding this comment.
Pull request overview
This PR hardens FileUploader screenshot capture by filtering problematic DOM resources and updating distribution bundles.
Changes:
- Filters iframes, unsafe images, and inaccessible stylesheets.
- Updates resource-origin handling.
- Regenerates readable and minified bundles.
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 1 comment.
| File | Summary |
|---|---|
js/src/fileuploader.js |
Adds screenshot resource filtering. The image check should use node.currentSrc with a node.src fallback to handle cross-origin srcset selections. |
dist/doboard-widget-bundle.min.js |
Regenerated minified bundle. |
dist/doboard-widget-bundle.js |
Regenerated readable bundle. |
Suppressed comments (2)
js/src/fileuploader.js:453
- Returning
falseremoves the external<img>from the cloned DOM rather than replacing only its pixels. If the image participates in flex, grid, or inline layout, the successful dom-to-image path reflows surrounding content; the fallback path instead substitutes a transparent pixel and preserves the image box at lines 501-504. Replace the image in the clone or otherwise preserve its dimensions when excluding the resource.
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;
js/src/fileuploader.js:463
toBlobis called withdocument.body, so the dom-to-image filter only visits body descendants. Normal<link rel="stylesheet">elements live indocument.headand never reach this branch, so inaccessible head stylesheets can still be processed and cause the capture to fail. Inspectdocument.styleSheetsin a preflight or handle stylesheet links in a document-level clone instead.
if (node.tagName === 'LINK' && node.rel === 'stylesheet') {
try {
if (node.sheet && !node.sheet.cssRules) return false;
} catch (e) {
return false;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+450
to
+453
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.