From 935e618982e725db50b8f3acb4c19bfeece8f75b Mon Sep 17 00:00:00 2001 From: shiva raj badu Date: Sat, 12 Jul 2025 00:28:21 +0545 Subject: [PATCH] fix(api/read-file):uncontrolled data use & remove(supporting doc): unused images logic --- .../upload/components/SupportingDoc.tsx | 19 +++++-------------- servers/nextjs/app/api/read-file/route.ts | 4 ++-- .../nextjs/app/api/slide-metadata/route.ts | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx b/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx index aca0469d..90a1beb1 100644 --- a/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx +++ b/servers/nextjs/app/(presentation-generator)/upload/components/SupportingDoc.tsx @@ -1,7 +1,7 @@ 'use client' import React, { useRef, useState } from 'react' -import { File, X, Upload, Image } from 'lucide-react' +import { File, X, Upload } from 'lucide-react' import { useToast } from '@/hooks/use-toast' import { cn } from '@/lib/utils' @@ -117,9 +117,6 @@ const SupportingDoc = ({ files, onFilesChange }: SupportingDocProps) => { onFilesChange(updatedFiles) } - const isImageFile = (file: File): boolean => { - return file.type?.startsWith('image/') || false - } return (
@@ -186,11 +183,7 @@ const SupportingDoc = ({ files, onFilesChange }: SupportingDocProps) => {
{filesWithIds.map((file) => { - const isImage = isImageFile(file); - let imageUrl = ''; - if (isImage) { - imageUrl = URL.createObjectURL(file); - } + return ( (
{
- {isImage ? ( - - ) : ( - - )} + + +