mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-07 06:00:03 +00:00
fix: Hide delete button for input assets in OSS and fix cloud download (#6697)
## Summary Fix delete button visibility for input assets in OSS environment and resolve 404 error when downloading assets in cloud. ## Changes ### 1. Improved Delete Button Visibility Logic - **Problem**: In OSS environment, input files are sourced from local folders and cannot be deleted - **Solution**: Added `shouldShowDeleteButton` computed property to conditionally hide delete buttons - **Impact**: - Input tab + Cloud: Delete button shown ✅ - Input tab + OSS: Delete button hidden ❌ - Output tab (all environments): Delete button shown ✅ ### 2. Fixed Cloud Download 404 Error - **Problem**: Downloading files from imported tab in cloud returned 404 error for `/api/view` endpoint - **Root Cause**: In cloud environment, files are stored in external storage (e.g., GCS) and `/api/view` endpoint is not available - **Solution**: - Cloud: Use `preview_url` directly for downloads - OSS/localhost: Continue using `/api/view` endpoint as before - Applied the same logic to both single and bulk download operations ## Test Plan - [ ] Verify delete button is hidden in input tab on OSS environment - [ ] Verify delete button is shown in input tab on cloud environment - [ ] Verify file downloads work correctly in cloud for both input and output tabs - [ ] Verify file downloads work correctly in OSS for output tab 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -25,11 +25,19 @@ export function useMediaAssetActions() {
|
||||
if (!asset) return
|
||||
|
||||
try {
|
||||
const assetType = asset.tags?.[0] || 'output'
|
||||
const filename = asset.name
|
||||
const downloadUrl = api.apiURL(
|
||||
`/view?filename=${encodeURIComponent(filename)}&type=${assetType}`
|
||||
)
|
||||
let downloadUrl: string
|
||||
|
||||
// In cloud, use preview_url directly (from cloud storage)
|
||||
// In OSS/localhost, use the /view endpoint
|
||||
if (isCloud && asset.src) {
|
||||
downloadUrl = asset.src
|
||||
} else {
|
||||
const assetType = asset.tags?.[0] || 'output'
|
||||
downloadUrl = api.apiURL(
|
||||
`/view?filename=${encodeURIComponent(filename)}&type=${assetType}`
|
||||
)
|
||||
}
|
||||
|
||||
downloadFile(downloadUrl, filename)
|
||||
|
||||
@@ -58,11 +66,19 @@ export function useMediaAssetActions() {
|
||||
|
||||
try {
|
||||
assets.forEach((asset) => {
|
||||
const assetType = asset.tags?.[0] || 'output'
|
||||
const filename = asset.name
|
||||
const downloadUrl = api.apiURL(
|
||||
`/view?filename=${encodeURIComponent(filename)}&type=${assetType}`
|
||||
)
|
||||
let downloadUrl: string
|
||||
|
||||
// In cloud, use preview_url directly (from GCS or other cloud storage)
|
||||
// In OSS/localhost, use the /view endpoint
|
||||
if (isCloud && asset.preview_url) {
|
||||
downloadUrl = asset.preview_url
|
||||
} else {
|
||||
const assetType = asset.tags?.[0] || 'output'
|
||||
downloadUrl = api.apiURL(
|
||||
`/view?filename=${encodeURIComponent(filename)}&type=${assetType}`
|
||||
)
|
||||
}
|
||||
downloadFile(downloadUrl, filename)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user