Fix: Block photo uploads on entity edits

This commit is contained in:
gpt-engineer-app[bot]
2025-11-02 20:39:22 +00:00
parent bb951e637f
commit bccaebc6d6
5 changed files with 106 additions and 118 deletions

View File

@@ -200,6 +200,19 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
const handleFormSubmit = async (data: ParkFormData) => {
try {
// CRITICAL: Block new photo uploads on edits
if (isEditing && data.images?.uploaded) {
const hasNewPhotos = data.images.uploaded.some(img => img.isLocal);
if (hasNewPhotos) {
toast({
variant: 'destructive',
title: 'Validation Error',
description: 'New photos cannot be added during edits. Please remove new photos or use the photo gallery.'
});
return;
}
}
// Build composite submission if new entities were created
const submissionContent: any = {
park: data,