-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Staging Release - October Week 4 Release (v24.44.0) #8909
Conversation
…and print buttons (#8879)
Co-authored-by: rithviknishad <[email protected]>
<> | ||
<div className="flex flex-1 items-center justify-center rounded-lg"> | ||
<img | ||
src={preview || imageUrl} |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we should ensure that the preview
URL is safe to use in the img
tag. One way to do this is to validate the file type and ensure it is an image before creating the object URL. Additionally, we can use a library like DOMPurify
to sanitize any potentially unsafe URLs, although this might be overkill for object URLs.
- Validate the file type to ensure it is an image before setting the
selectedFile
. - Use
URL.createObjectURL
to generate a safe URL for the image file. - Ensure that the
preview
variable is only set with valid image URLs.
-
Copy modified lines R91-R95 -
Copy modified lines R104-R105 -
Copy modified line R109
@@ -90,5 +90,7 @@ | ||
if (selectedFile) { | ||
const objectUrl = URL.createObjectURL(selectedFile); | ||
setPreview(objectUrl); | ||
return () => URL.revokeObjectURL(objectUrl); | ||
if (selectedFile.type.split("/")[0] === "image") { | ||
const objectUrl = URL.createObjectURL(selectedFile); | ||
setPreview(objectUrl); | ||
return () => URL.revokeObjectURL(objectUrl); | ||
} | ||
} | ||
@@ -101,3 +103,4 @@ | ||
} | ||
if (e.target.files[0]?.type.split("/")[0] !== "image") { | ||
const file = e.target.files[0]; | ||
if (file?.type.split("/")[0] !== "image") { | ||
Warn({ msg: "Please upload an image file!" }); | ||
@@ -105,3 +108,3 @@ | ||
} | ||
setSelectedFile(e.target.files[0]); | ||
setSelectedFile(file); | ||
}; |
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Deploying care-fe with Cloudflare Pages
|
👋 Hi, @khavinshankar, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
@khavinshankar Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌 |
No description provided.