Skip to content

Commit

Permalink
fix: add ks to image download request (#24)
Browse files Browse the repository at this point in the history
add ks to image request download url.
  • Loading branch information
lianbenjamin authored Oct 19, 2023
1 parent 8b28373 commit 205ca0d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/services/download-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DownloadService {
return null;
}

const requestUrl = this.player.isImage() && this.player.sources.downloadUrl ? this.player.sources.downloadUrl : this.getDownloadUrl(config);
const requestUrl = this.getRequestUrl(config);
if (!requestUrl) {
return null;
}
Expand All @@ -83,6 +83,16 @@ class DownloadService {
return null;
}

getRequestUrl(config: DownloadConfig): string {
if (this.player.isImage()) {
const requestUrl = this.player.sources.downloadUrl;
if (!requestUrl) return '';
const ks = this.player.config.session.ks;
return ks ? `${requestUrl}/ks/${ks}` : requestUrl;
}
return this.getDownloadUrl(config);
}

downloadFile(downloadUrl: string, fileName: string) {
const aElement = document.createElement('a');
aElement.href = downloadUrl;
Expand Down

0 comments on commit 205ca0d

Please sign in to comment.