3 Commits

Author SHA1 Message Date
8cbd8d5da9 Update build.gradle 2024-03-07 22:05:43 +00:00
91ed183052 Merge pull request 'Fixed download bug' (#15) from bugfix/download-cache into main
Reviewed-on: https://git.walzen665.de/Walzen665/sharepulse/pulls/15
2024-03-07 22:01:10 +00:00
Max
b127b788b2 Fixed download bug
- Fixed: Multiple files could not be downloaded due to a caching issue
2024-03-07 22:54:50 +01:00
2 changed files with 10 additions and 2 deletions

View File

@ -5,7 +5,7 @@ plugins {
} }
group = 'de.w665' group = 'de.w665'
version = '1.0.0' version = '1.0.1'
java { java {
sourceCompatibility = '21' sourceCompatibility = '21'

View File

@ -172,12 +172,20 @@ export class DownloadComponent {
const blob = new Blob([response.data], {type: 'application/octet-stream'}); const blob = new Blob([response.data], {type: 'application/octet-stream'});
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
// Check if download blob already exists and remove it if it does
let a = document.getElementById('fileDownloadBlob') as HTMLAnchorElement | null;
if (a !== null) {
a.remove();
}
a = document.createElement('a');
a.style.display = 'none'; a.style.display = 'none';
a.href = url; a.href = url;
a.download = filename; a.download = filename;
a.id = 'fileDownloadBlob'; a.id = 'fileDownloadBlob';
document.body.appendChild(a); document.body.appendChild(a);
this.saveDownloadedFile(); this.saveDownloadedFile();
// Clean up by revoking the Blob URL and removing the temporary anchor (currently disabled due to saveDownloadBtn) // Clean up by revoking the Blob URL and removing the temporary anchor (currently disabled due to saveDownloadBtn)