Skip to content

Feat/support custom file extensions instead of mime types for file records#819

Merged
KallynGowdy merged 7 commits intodevelopfrom
feat/Support_custom_file_extensions_instead_of_mime_types_for_file_records
Apr 1, 2026
Merged

Feat/support custom file extensions instead of mime types for file records#819
KallynGowdy merged 7 commits intodevelopfrom
feat/Support_custom_file_extensions_instead_of_mime_types_for_file_records

Conversation

@TroyceGowdy
Copy link
Copy Markdown
Contributor

fixes #799

add fileExtension option to os.recordFile() API and record file actions
allow file uploads with fileExtension when MIME type is unavailable
wire fileExtension through AuxLibrary.ts, RecordsManager.ts, and records server/controller
make fileMimeType optional for record-file requests when fileExtension is provided
@TroyceGowdy TroyceGowdy added this to the v3.5.x milestone Mar 23, 2026
@TroyceGowdy TroyceGowdy self-assigned this Mar 23, 2026
@TroyceGowdy TroyceGowdy added enhancement New feature or request area:backend Is related to the backend server. (Everything in aux-records and aux-server/aux-backend) labels Mar 23, 2026
@github-project-automation github-project-automation bot moved this to To triage in CasualOS Mar 23, 2026
Copy link
Copy Markdown
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

Adds support for specifying a custom file extension when recording file records, enabling uploads for formats without well-known MIME types (fixes #799).

Changes:

  • Extends the client/runtime record-file APIs to accept fileExtension and propagate it through to the records server.
  • Updates records server validation and file-record handling to allow fileMimeType to be optional when fileExtension is provided (and validate mismatches when both are provided).
  • Adds/updates tests and snapshots for the new request shape and behavior, plus a changelog entry.

Reviewed changes

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

Show a summary per file
File Description
src/aux-vm/managers/RecordsManager.ts Sends fileExtension to the records API and conditionally omits fileMimeType when only an extension is provided.
src/aux-runtime/runtime/RecordsEvents.ts Adds fileExtension to RecordFileAction and updates the recordFile() action creator signature.
src/aux-runtime/runtime/AuxLibrary.ts Extends os.recordFile() options to include fileExtension and forwards it into the action.
src/aux-records/snapshots/RecordsServer.spec.ts.snap Updates API schema snapshots to reflect optional fileMimeType and new fileExtension.
src/aux-records/Validations.ts Updates request schema to allow optional fileMimeType and adds fileExtension.
src/aux-records/RecordsServer.tsx Allows requests that specify either fileMimeType or fileExtension and forwards fileExtension into the file controller.
src/aux-records/RecordsServer.spec.ts Adds coverage for extension-only requests and mismatch validation.
src/aux-records/FileRecordsController.ts Implements extension-based filename generation, mismatch validation, and defaults MIME type for presigned uploads.
src/aux-records/FileRecordsController.spec.ts Adds tests for extension-based filename generation and mismatch validation.
CHANGELOG.md Documents the new feature.

Comment on lines 382 to 388
const presignResult = await this._store.presignFileUpload({
recordName,
fileName: fileName,
fileSha256Hex: request.fileSha256Hex,
fileMimeType: request.fileMimeType,
fileMimeType:
request.fileMimeType ?? 'application/octet-stream',
fileByteLength: request.fileByteLength,
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

When fileExtension is used without fileMimeType, request.fileMimeType is undefined until the presign call (where it defaults to application/octet-stream). This means any allowedMimeTypes policy checks earlier in this method will always fail for extension-only uploads. Consider computing an effectiveMimeType (defaulting to application/octet-stream) once and using it consistently for both policy enforcement and the presign request.

Copilot uses AI. Check for mistakes.
@KallynGowdy
Copy link
Copy Markdown
Member

@TroyceGowdy Can you go through the Copilot suggestions and apply/resolve them?

@KallynGowdy KallynGowdy merged commit a3a2116 into develop Apr 1, 2026
9 of 18 checks passed
@github-project-automation github-project-automation bot moved this from To triage to Done in CasualOS Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Is related to the backend server. (Everything in aux-records and aux-server/aux-backend) enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support custom file extensions instead of mime types for file records

3 participants