mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: invalid server tool url caused crash (#2311)
This commit is contained in:
parent
625b0afa52
commit
b5ed81b349
|
@ -126,6 +126,19 @@ const EditCustomCollectionModal: FC<Props> = ({
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPath = (url: string) => {
|
||||||
|
if (!url)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const path = new URL(url).pathname
|
||||||
|
return path || ''
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Drawer
|
<Drawer
|
||||||
|
@ -202,7 +215,7 @@ const EditCustomCollectionModal: FC<Props> = ({
|
||||||
<td className="p-2 pl-3">{item.operation_id}</td>
|
<td className="p-2 pl-3">{item.operation_id}</td>
|
||||||
<td className="p-2 pl-3 text-gray-500 w-[236px]">{item.summary}</td>
|
<td className="p-2 pl-3 text-gray-500 w-[236px]">{item.summary}</td>
|
||||||
<td className="p-2 pl-3">{item.method}</td>
|
<td className="p-2 pl-3">{item.method}</td>
|
||||||
<td className="p-2 pl-3">{item.server_url ? new URL(item.server_url).pathname : ''}</td>
|
<td className="p-2 pl-3">{getPath(item.server_url)}</td>
|
||||||
<td className="p-2 pl-3 w-[62px]">
|
<td className="p-2 pl-3 w-[62px]">
|
||||||
<Button
|
<Button
|
||||||
className='!h-6 !px-2 text-xs font-medium text-gray-700 whitespace-nowrap'
|
className='!h-6 !px-2 text-xs font-medium text-gray-700 whitespace-nowrap'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user