From ee583f9183af8893d100eae88fb8b14004b9850c Mon Sep 17 00:00:00 2001 From: Ece Eren Date: Tue, 12 Nov 2024 23:09:38 +0100 Subject: [PATCH 1/2] Add ngsw-bypass as a header --- src/main/webapp/app/lecture/attachment.service.ts | 5 ++++- .../lecture-unit-management/attachmentUnit.service.ts | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/app/lecture/attachment.service.ts b/src/main/webapp/app/lecture/attachment.service.ts index 446d26960f8b..df9fb33b336e 100644 --- a/src/main/webapp/app/lecture/attachment.service.ts +++ b/src/main/webapp/app/lecture/attachment.service.ts @@ -35,8 +35,11 @@ export class AttachmentService { copy.lecture.posts = undefined; } + /** Ngsw-worker is bypassed temporarily to fix Chromium file upload issue + * See: https://issues.chromium.org/issues/374550348 + **/ return this.http - .post(this.resourceUrl, this.createFormData(copy, file), { observe: 'response' }) + .post(this.resourceUrl, this.createFormData(copy, file), { headers: { 'ngsw-bypass': 'true' }, observe: 'response' }) .pipe(map((res: EntityResponseType) => this.convertAttachmentResponseDatesFromServer(res))); } diff --git a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts index 533d454f9a06..24e3fd393723 100644 --- a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts +++ b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts @@ -26,8 +26,14 @@ export class AttachmentUnitService { } create(formData: FormData, lectureId: number): Observable { + /** Ngsw-worker is bypassed temporarily to fix Chromium file upload issue + * See: https://issues.chromium.org/issues/374550348 + **/ return this.httpClient - .post(`${this.resourceURL}/lectures/${lectureId}/attachment-units?keepFilename=true`, formData, { observe: 'response' }) + .post(`${this.resourceURL}/lectures/${lectureId}/attachment-units?keepFilename=true`, formData, { + headers: { 'ngsw-bypass': 'true' }, + observe: 'response', + }) .pipe(map((res: EntityResponseType) => this.lectureUnitService.convertLectureUnitResponseDatesFromServer(res))); } From ad63c980619dba6520db3b2f783e3a83c171db99 Mon Sep 17 00:00:00 2001 From: Ece Eren Date: Wed, 13 Nov 2024 00:02:53 +0100 Subject: [PATCH 2/2] Bypass ngsw-worker for update requests --- src/main/webapp/app/lecture/attachment.service.ts | 5 ++++- .../lecture-unit-management/attachmentUnit.service.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/app/lecture/attachment.service.ts b/src/main/webapp/app/lecture/attachment.service.ts index df9fb33b336e..cd8a93d7b94f 100644 --- a/src/main/webapp/app/lecture/attachment.service.ts +++ b/src/main/webapp/app/lecture/attachment.service.ts @@ -54,8 +54,11 @@ export class AttachmentService { const options = createRequestOption(req); const copy = this.convertAttachmentDatesFromClient(attachment); + /** Ngsw-worker is bypassed temporarily to fix Chromium file upload issue + * See: https://issues.chromium.org/issues/374550348 + **/ return this.http - .put(this.resourceUrl + '/' + attachmentId, this.createFormData(copy, file), { params: options, observe: 'response' }) + .put(this.resourceUrl + '/' + attachmentId, this.createFormData(copy, file), { headers: { 'ngsw-bypass': 'true' }, params: options, observe: 'response' }) .pipe(map((res: EntityResponseType) => this.convertAttachmentResponseDatesFromServer(res))); } diff --git a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts index 24e3fd393723..4a5e3ed80a71 100644 --- a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts +++ b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/attachmentUnit.service.ts @@ -38,12 +38,15 @@ export class AttachmentUnitService { } update(lectureId: number, attachmentUnitId: number, formData: FormData, notificationText?: string): Observable { + /** Ngsw-worker is bypassed temporarily to fix Chromium file upload issue + * See: https://issues.chromium.org/issues/374550348 + **/ return this.httpClient .put( `${this.resourceURL}/lectures/${lectureId}/attachment-units/${attachmentUnitId}?keepFilename=true` + (notificationText ? `¬ificationText=${notificationText}` : ''), formData, - { observe: 'response' }, + { headers: { 'ngsw-bypass': 'true' }, observe: 'response' }, ) .pipe(map((res: EntityResponseType) => this.lectureUnitService.convertLectureUnitResponseDatesFromServer(res))); }