Fix: Resolve image upload and form integration issues

This commit is contained in:
gpt-engineer-app[bot]
2025-10-01 19:02:21 +00:00
parent 37b70111c6
commit 83260e7f73
6 changed files with 57 additions and 199 deletions

View File

@@ -202,7 +202,7 @@ export function EntityMultiImageUploader({
onUploadComplete={handleUploadComplete}
maxFiles={maxImages - value.uploaded.length}
variant="compact"
allowedFileTypes={['image/jpeg', 'image/jpg', 'image/png', 'image/webp']}
allowedFileTypes={['image/*']}
/>
</div>
</Card>

View File

@@ -77,15 +77,20 @@ export function UppyPhotoUpload({
return `File "${file.name}" exceeds ${maxSizeMB}MB limit`;
}
const allowedTypes = allowedFileTypes.map(type =>
type.replace('*', '').replace('/', '')
);
if (!allowedTypes.includes('image') && !allowedFileTypes.includes('image/*')) {
const fileType = file.type.split('/')[0];
if (!allowedTypes.includes(fileType)) {
return `File type "${file.type}" is not allowed`;
// Check if file type is allowed
// Support both wildcard (image/*) and specific types (image/jpeg, image/png)
const isWildcardMatch = allowedFileTypes.some(type => {
if (type.includes('*')) {
const prefix = type.split('/')[0];
return file.type.startsWith(prefix + '/');
}
return false;
});
const isExactMatch = allowedFileTypes.includes(file.type);
if (!isWildcardMatch && !isExactMatch) {
return `File type "${file.type}" is not allowed`;
}
return null;