set the correct file name when triggering a download (#1513)

This commit is contained in:
Ionuț Staicu
2025-11-20 21:11:45 -07:00
committed by GitHub
parent 278b11e9e1
commit 014874cd11
4 changed files with 21 additions and 20 deletions
@@ -213,7 +213,7 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
label: 'Download',
icon: 'pi pi-download',
command: () => {
this.bookService.downloadFile(this.book.id);
this.bookService.downloadFile(this.book);
}
});
} else {
@@ -512,7 +512,7 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
label: `${this.book.fileName || 'Book File'}`,
icon: 'pi pi-file',
command: () => {
this.bookService.downloadFile(this.book.id);
this.bookService.downloadFile(this.book);
}
});
@@ -528,7 +528,7 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
items.push({
label: `${format.fileName} (${this.getFileSizeInMB(format)})`,
icon: this.getFileIcon(extension),
command: () => this.downloadAdditionalFile(this.book.id, format.id)
command: () => this.downloadAdditionalFile(this.book, format.id)
});
});
}
@@ -546,7 +546,7 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
items.push({
label: `${file.fileName} (${this.getFileSizeInMB(file)})`,
icon: this.getFileIcon(extension),
command: () => this.downloadAdditionalFile(this.book.id, file.id)
command: () => this.downloadAdditionalFile(this.book, file.id)
});
});
}
@@ -619,8 +619,8 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
!!(this.book.supplementaryFiles && this.book.supplementaryFiles.length > 0);
}
private downloadAdditionalFile(bookId: number, fileId: number): void {
this.bookService.downloadAdditionalFile(bookId, fileId);
private downloadAdditionalFile(book: Book, fileId: number): void {
this.bookService.downloadAdditionalFile(book, fileId);
}
private deleteAdditionalFile(bookId: number, fileId: number, fileName: string): void {