From 944d731573215ab1c07cd4c3ab1f3e8f162c394b Mon Sep 17 00:00:00 2001 From: chyoo Date: Wed, 8 Jul 2026 15:06:11 +0900 Subject: [PATCH] r2 modify --- k8s/lms-api-ingressroute.yaml | 25 +++++++++++++++++++++++++ src/instructor/instructor.service.ts | 1 - src/storage/r2-public-file.service.ts | 7 ------- 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 k8s/lms-api-ingressroute.yaml diff --git a/k8s/lms-api-ingressroute.yaml b/k8s/lms-api-ingressroute.yaml new file mode 100644 index 0000000..4e5eb63 --- /dev/null +++ b/k8s/lms-api-ingressroute.yaml @@ -0,0 +1,25 @@ +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: lms-api-strip +spec: + stripPrefix: + prefixes: + - /lms-api +--- +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: lms-api +spec: + entryPoints: + - web + routes: + - match: Host(`workspace.autonomystudio.net`) && PathPrefix(`/lms-api`) + kind: Rule + middlewares: + - name: lms-api-strip + services: + - name: lms-be + port: 4400 + diff --git a/src/instructor/instructor.service.ts b/src/instructor/instructor.service.ts index d056b78..1a2f6d3 100644 --- a/src/instructor/instructor.service.ts +++ b/src/instructor/instructor.service.ts @@ -1551,7 +1551,6 @@ export class InstructorService { key: storedFileName, body: file.buffer, contentType: file.mimetype, - fileName: originalFileName, }); } else { await mkdir(COURSE_REFERENCE_UPLOAD_ROOT, { recursive: true }); diff --git a/src/storage/r2-public-file.service.ts b/src/storage/r2-public-file.service.ts index 233ca74..321ddee 100644 --- a/src/storage/r2-public-file.service.ts +++ b/src/storage/r2-public-file.service.ts @@ -6,7 +6,6 @@ type UploadPublicFileInput = { key: string; body: Buffer; contentType?: string | null; - fileName?: string | null; }; @Injectable() @@ -53,7 +52,6 @@ export class R2PublicFileService { Body: input.body, ContentLength: input.body.length, ContentType: input.contentType ?? 'application/octet-stream', - ContentDisposition: input.fileName ? contentDispositionForFile(input.fileName) : undefined, })); return this.publicUrl(input.key); @@ -120,8 +118,3 @@ export class R2PublicFileService { function encodeObjectKey(key: string) { return key.split('/').map(encodeURIComponent).join('/'); } - -function contentDispositionForFile(fileName: string) { - const fallbackName = fileName.replace(/[\\\"\r\n]/g, '_'); - return `attachment; filename="${fallbackName}"; filename*=UTF-8''${encodeURIComponent(fileName)}`; -}