Skip to content

Commit

Permalink
Improves image upload handling
Browse files Browse the repository at this point in the history
Removes redundant code in image upload handling, improving efficiency and readability.  The change simplifies the URL creation and revocation process.
  • Loading branch information
charlwillia6 committed Feb 4, 2025
1 parent acf1b0a commit 86dbaa0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions gui/src/components/mainInput/TipTapEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,12 @@ export const handleImageFile = async (
filesize < 10
) {
// check dimensions
const _URL = window.URL || window.webkitURL;
const img = new window.Image();
const url = _URL.createObjectURL(file);
img.src = url;

img.src = URL.createObjectURL(file);

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.
return await new Promise((resolve) => {
const safeRevokeURL = () => {
try {
URL.revokeObjectURL(url);
URL.revokeObjectURL(img.src);
} catch (error) {
console.error('Error revoking URL:', error);
}
Expand Down

0 comments on commit 86dbaa0

Please sign in to comment.