mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-15 06:58:51 +01:00
fix: add optional chaining to file type checks in DragDropModal and Columns to prevent runtime errors
This commit is contained in:
parent
f868bb7df7
commit
670f9b8daf
2 changed files with 5 additions and 4 deletions
|
|
@ -34,7 +34,7 @@ const DragDropModal = ({ onOptionSelect, setShowModal, files, isVisible }: DragD
|
|||
label: localize('com_ui_upload_image_input'),
|
||||
value: undefined,
|
||||
icon: <ImageUpIcon className="icon-md" />,
|
||||
condition: files.every((file) => file.type.startsWith('image/')),
|
||||
condition: files.every((file) => file.type?.startsWith('image/')),
|
||||
},
|
||||
];
|
||||
for (const capability of capabilities) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
|
||||
import { ArrowUpDown, Database } from 'lucide-react';
|
||||
import { FileSources, FileContext } from 'librechat-data-provider';
|
||||
|
|
@ -68,7 +69,7 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
},
|
||||
cell: ({ row }) => {
|
||||
const file = row.original;
|
||||
if (file.type.startsWith('image')) {
|
||||
if (file.type?.startsWith('image')) {
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<ImagePreview
|
||||
|
|
@ -76,7 +77,7 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
className="relative h-10 w-10 shrink-0 overflow-hidden rounded-md"
|
||||
source={file.source}
|
||||
/>
|
||||
<span className="self-center truncate ">{file.filename}</span>
|
||||
<span className="self-center truncate">{file.filename}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -212,4 +213,4 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
return `${value}${suffix}`;
|
||||
},
|
||||
},
|
||||
];
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue