fix: SFTP下载使用新窗口打开直链
- app.js downloadFile: SFTP有直链时用window.open新窗口打开 - share.html downloadFile: 分享页面同样处理 - 本地存储下载保持原有方式不变 - 解决HTTPS页面下载HTTP直链的Mixed Content问题 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -983,11 +983,15 @@ handleDragLeave(e) {
|
||||
|
||||
downloadFile(file) {
|
||||
console.log("[DEBUG] 下载文件:", file);
|
||||
const url = file.httpDownloadUrl
|
||||
? file.httpDownloadUrl
|
||||
: `${this.apiBase}/api/files/download?path=${encodeURIComponent(this.currentPath === '/' ? `/${file.name}` : `${this.currentPath}/${file.name}`)}`;
|
||||
|
||||
// 统一通过隐藏链接触发下载,避免弹出新窗口
|
||||
// SFTP存储且有HTTP直链,新窗口打开直接下载(避免Mixed Content问题)
|
||||
if (file.httpDownloadUrl) {
|
||||
window.open(file.httpDownloadUrl, '_blank');
|
||||
return;
|
||||
}
|
||||
|
||||
// 本地存储,使用隐藏链接触发下载
|
||||
const url = `${this.apiBase}/api/files/download?path=${encodeURIComponent(this.currentPath === '/' ? `/${file.name}` : `${this.currentPath}/${file.name}`)}`;
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute('download', file.name);
|
||||
|
||||
Reference in New Issue
Block a user