Merge pull request #434 from jamebal/dev

refactor(file-config): 重构直接文件 URL 生成逻辑
This commit is contained in:
jmal 2025-06-29 12:16:53 +08:00 committed by GitHub
commit 24c6ae7ed9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,10 +144,8 @@ export default {
return null; return null;
}, },
directFileUrl: function(mark, file) { directFileUrl: function(mark, file) {
if (file.isFolder) { const encodedName = encodeURIComponent(file.name);
return window.location.origin + `${this.baseUrl}/direct-file/${mark}/${encodeURI(file.name)}.zip` const suffix = file.isFolder ? '.zip' : '';
} else { return `${window.location.origin}${this.baseUrl}/direct-file/${mark}/${encodedName}${suffix}`
return window.location.origin + `${this.baseUrl}/direct-file/${mark}/${encodeURI(file.name)}`
}
} }
} }