mirror of
https://github.com/langgenius/dify.git
synced 2026-05-09 21:28:25 +08:00
fix: use downloadUrl utility instead of window.open for file downloads
Replace window.open with downloadUrl from utils/download to trigger proper file downloads instead of opening files in a new browser tab.
This commit is contained in:
parent
807d0e5fba
commit
5c91311077
@ -9,6 +9,7 @@ import FolderSpark from '@/app/components/base/icons/src/vender/workflow/FolderS
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { useDownloadSandboxFile, useSandboxFilesTree } from '@/service/use-sandbox-file'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { downloadUrl } from '@/utils/download'
|
||||
import ArtifactsTree from './artifacts-tree'
|
||||
|
||||
type ArtifactsSectionProps = {
|
||||
@ -33,7 +34,7 @@ const ArtifactsSection = ({ className }: ArtifactsSectionProps) => {
|
||||
const handleDownload = useCallback(async (node: SandboxFileTreeNode) => {
|
||||
try {
|
||||
const ticket = await downloadMutation.mutateAsync(node.path)
|
||||
window.open(ticket.download_url, '_blank')
|
||||
downloadUrl({ url: ticket.download_url, fileName: node.name })
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Download failed:', error)
|
||||
|
||||
@ -16,6 +16,7 @@ import { useAppContext } from '@/context/app-context'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useDownloadSandboxFile, useSandboxFileDownloadUrl, useSandboxFilesTree } from '@/service/use-sandbox-file'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { downloadUrl } from '@/utils/download'
|
||||
import InspectLayout from './inspect-layout'
|
||||
import SplitPanel from './split-panel'
|
||||
|
||||
@ -76,7 +77,7 @@ const ArtifactsTab = (headerProps: InspectHeaderProps) => {
|
||||
const handleDownload = useCallback(async (node: SandboxFileTreeNode) => {
|
||||
try {
|
||||
const ticket = await downloadFile(node.path)
|
||||
window.open(ticket.download_url, '_blank')
|
||||
downloadUrl({ url: ticket.download_url, fileName: node.name })
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Download failed:', error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user