Skip to content
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

Merged
merged 26 commits into from
Oct 24, 2024
Merged

Staging Release - October Week 4 Release (v24.44.0) #8909

merged 26 commits into from
Oct 24, 2024

Conversation

khavinshankar
Copy link
Member

No description provided.

abhip161 and others added 25 commits October 21, 2024 09:45
<>
<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
is reinterpreted as HTML without escaping meta-characters.

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.

  1. Validate the file type to ensure it is an image before setting the selectedFile.
  2. Use URL.createObjectURL to generate a safe URL for the image file.
  3. Ensure that the preview variable is only set with valid image URLs.
Suggested changeset 1
src/components/Common/AvatarEditModal.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/components/Common/AvatarEditModal.tsx b/src/components/Common/AvatarEditModal.tsx
--- a/src/components/Common/AvatarEditModal.tsx
+++ b/src/components/Common/AvatarEditModal.tsx
@@ -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);
   };
EOF
@@ -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);
};
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link

netlify bot commented Oct 24, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 7eee0ff
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6719b394b1c25600081649a4
😎 Deploy Preview https://deploy-preview-8909--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

cloudflare-workers-and-pages bot commented Oct 24, 2024

Deploying care-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7eee0ff
Status: ✅  Deploy successful!
Preview URL: https://49d80edd.care-fe.pages.dev

View logs

@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Oct 24, 2024
Copy link

👋 Hi, @khavinshankar,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

@khavinshankar khavinshankar removed the merge conflict pull requests with merge conflict label Oct 24, 2024
@khavinshankar khavinshankar marked this pull request as ready for review October 24, 2024 07:09
@khavinshankar khavinshankar requested a review from a team as a code owner October 24, 2024 07:09
@khavinshankar khavinshankar changed the title Staging Release - October Week 3 Release Patch (v24.44.0) Staging Release - October Week 3 Release (v24.44.0) Oct 24, 2024
@khavinshankar khavinshankar changed the title Staging Release - October Week 3 Release (v24.44.0) Staging Release - October Week 4 Release (v24.44.0) Oct 24, 2024
@gigincg gigincg merged commit b6e5fa7 into staging Oct 24, 2024
78 of 91 checks passed
Copy link

@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! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.