Skip to content

Commit

Permalink
chore: validate image before compression
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jan 19, 2024
1 parent cdc326c commit 629180b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/uploader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const UploadImg = ({
accept='.gif, .png, .jpeg, .jpg'
action={async file => {
const compressedImage = await resizeImage(file)
if (compressedImage && validateImage(compressedImage)) {
if (compressedImage) {
try {
setLoading(true)
const cid = await ipfs.saveFileToOffchain(compressedImage)
Expand All @@ -90,6 +90,7 @@ export const UploadImg = ({
listType={listType}
showUploadList={false}
className={styles.DfUploadImg}
beforeUpload={validateImage}
{...props}
>
<UploadButton loading={loading} />
Expand Down

0 comments on commit 629180b

Please sign in to comment.