Skip to content

Conversation

@ycdzj
Copy link
Contributor

@ycdzj ycdzj commented Nov 14, 2025

No description provided.

@ycdzj ycdzj marked this pull request as ready for review November 17, 2025 04:06
Copilot AI review requested due to automatic review settings November 17, 2025 04:06
Copilot finished reviewing on behalf of ycdzj November 17, 2025 04:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors S3 upload handling by removing content-type enforcement from presigned POST requests and adds file type validation at the application layer. The key changes include moving from S3-level content-type conditions to server-side file extension validation.

  • Removed contentType parameter from S3 upload form generation, allowing clients to specify content-type freely
  • Added whitelist-based file extension validation in FilesService.createFile() with a set of allowed file types
  • Introduced file existence verification in ResourcesService.createResource() using S3 HEAD requests

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/s3/s3.service.ts Removed contentType parameter and related conditions/fields from generateUploadForm method
src/files/files.service.ts Added ALLOWED_FILE_EXTENSIONS constant, file type validation in createFile, made mimetype optional, removed mimetype parameter from generateUploadForm, added headFile method
src/namespace-resources/namespace-resources.service.ts Removed mime-types import and fallback logic, removed mimetype parameter from generateUploadForm call
src/resources/resources.service.ts Added FilesService injection and file existence check using headFile in createResource
src/resources/resources.module.ts Added FilesModule to module imports
src/i18n/en/resource.json Added "fileTypeNotSupported" translation
src/i18n/zh/resource.json Added "fileTypeNotSupported" translation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ycdzj ycdzj merged commit 5f26919 into main Nov 17, 2025
5 checks passed
@ycdzj ycdzj deleted the refactor/s3 branch November 17, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants