Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(image-input): enforce image types on upload (#8054)

LoneRifle7ae3494cccab
diff --git a/frontend/src/components/features/images/upload-image-input.tsx b/frontend/src/components/features/images/upload-image-input.tsx
index 9919120f3b..c55d695b12 100644
--- a/frontend/src/components/features/images/upload-image-input.tsx
+++ b/frontend/src/components/features/images/upload-image-input.tsx
@@ -7,7 +7,12 @@ interface UploadImageInputProps {
export function UploadImageInput({ onUpload, label }: UploadImageInputProps) {
const handleUpload = (event: React.ChangeEvent<HTMLInputElement>) => {
- if (event.target.files) onUpload(Array.from(event.target.files));
+ if (event.target.files) {
+ const validFiles = Array.from(event.target.files).filter((file) =>
+ file.type.startsWith("image/"),
+ );
+ onUpload(validFiles);
+ }
};
return (