getAttachmentUnitAttachment(@PathVariable Long att
// check if the user is authorized to access the requested attachment unit
checkAttachmentAuthorizationOrThrow(course, attachment);
- return buildFileResponse(getActualPathFromPublicPathString(attachment.getLink()), Optional.of(attachment.getName()));
+ return buildFileResponse(getActualPathFromPublicPathString(attachment.getLink()), Optional.of(attachment.getName() + "." + getExtension(attachment.getLink())));
}
/**
diff --git a/src/main/webapp/app/lecture/lecture-attachments.component.html b/src/main/webapp/app/lecture/lecture-attachments.component.html
index 82050a7c3efe..7b47f8c48e7e 100644
--- a/src/main/webapp/app/lecture/lecture-attachments.component.html
+++ b/src/main/webapp/app/lecture/lecture-attachments.component.html
@@ -58,7 +58,7 @@
@if (!isDownloadingAttachmentLink) {
-
+
{{ attachment.name }}
} @else if (isDownloadingAttachmentLink === attachment.link) {
diff --git a/src/main/webapp/app/lecture/lecture-attachments.component.ts b/src/main/webapp/app/lecture/lecture-attachments.component.ts
index c49304e3bee7..fd9d7633baa4 100644
--- a/src/main/webapp/app/lecture/lecture-attachments.component.ts
+++ b/src/main/webapp/app/lecture/lecture-attachments.component.ts
@@ -254,10 +254,10 @@ export class LectureAttachmentsComponent implements OnDestroy {
return item.id;
}
- downloadAttachment(downloadUrl: string): void {
+ downloadAttachment(downloadName: string, downloadUrl: string): void {
if (!this.isDownloadingAttachmentLink) {
this.isDownloadingAttachmentLink = downloadUrl;
- this.fileService.downloadFile(this.fileService.replaceLectureAttachmentPrefixAndUnderscores(downloadUrl));
+ this.fileService.downloadFileByAttachmentName(downloadUrl, downloadName);
this.isDownloadingAttachmentLink = undefined;
}
}
diff --git a/src/main/webapp/app/overview/course-lectures/attachment-unit/attachment-unit.component.ts b/src/main/webapp/app/overview/course-lectures/attachment-unit/attachment-unit.component.ts
index 5634aeda7a5e..ecc6c9f39f85 100644
--- a/src/main/webapp/app/overview/course-lectures/attachment-unit/attachment-unit.component.ts
+++ b/src/main/webapp/app/overview/course-lectures/attachment-unit/attachment-unit.component.ts
@@ -51,7 +51,7 @@ export class AttachmentUnitComponent extends LectureUnitDirective
|