fileuploader fixed - #121
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the automatic screenshot flow in FileUploader to improve reliability when capturing pages that can taint canvases (cross-origin CSS/images/iframes), preferring dom-to-image-more when the page appears “safe” and falling back to html2canvas with sanitization.
Changes:
- Added a “page safety” pre-check to decide whether to attempt
dom-to-image-more. - Adjusted
html2canvasoptions and added anonclonehook to remove/replace elements that can taint screenshots. - Updated the built bundle to reflect the source changes.
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| js/src/fileuploader.js | Adds safety detection and refactors screenshot capture to prefer dom-to-image-more and sanitize html2canvas rendering. |
| dist/doboard-widget-bundle.js | Regenerated bundle including the updated screenshot logic. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (3)
js/src/fileuploader.js:425
sheet.cssRulesis only being read to detect cross-origin stylesheets, but the assignedrulesvariable is unused. This can triggerno-unused-varslinting and makes the intent less clear; just access the property without assigning it (or usevoid).
try {
const rules = sheet.cssRules;
} catch (e) {
js/src/fileuploader.js:444
isPageSafeForDomToImage()returnsnullon URL parsing errors, but callers treat the result as a boolean (if (isSafe)). Returning a non-boolean makes behavior harder to reason about; returningfalsekeeps the contract consistent and still routes to the html2canvas fallback.
} catch (e){
return null;
}
js/src/fileuploader.js:457
- The guard condition also covers an uninitialized/invalid
this.files(!this.files || !Array.isArray(this.files)), but the log message only mentions the file-count limit. This can mislead debugging when the uploader isn't initialized yet.
if (!this.files || !Array.isArray(this.files) || this.files.length >= this.maxFiles) {
console.log('SpotFix: File count limit reached.');
return;
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (2)
js/src/fileuploader.js:500
- The fallback
catchlogs only the raw error object, losing context about what operation failed. Adding a stable, SpotFix-prefixed message improves debuggability while still preserving the error details/stack.
} catch (error) {
console.error(error);
return null;
}
js/src/fileuploader.js:454
console.warn(error.message)can logundefinedfor non-Error rejections and drops the stack trace/context, which makes diagnosing screenshot failures harder. Log a stable SpotFix-prefixed message and include the error object.
This issue also appears on line 497 of the same file.
} catch (error) {
console.warn(error.message);
blob = null;
}
No description provided.