Fix learning hub upload: ensure mopc-learning bucket exists
All checks were successful
Build and Push Docker Image / build (push) Successful in 10m4s
All checks were successful
Build and Push Docker Image / build (push) Successful in 10m4s
The getUploadUrl procedure generated a presigned PUT URL without first checking that the mopc-learning bucket exists, causing all uploads to fail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
protectedProcedure,
|
||||
adminProcedure,
|
||||
} from '../trpc'
|
||||
import { getPresignedUrl } from '@/lib/minio'
|
||||
import { getPresignedUrl, ensureBucket } from '@/lib/minio'
|
||||
import { logAudit } from '../utils/audit'
|
||||
|
||||
// Bucket for learning resources
|
||||
@@ -415,6 +415,7 @@ export const learningResourceRouter = router({
|
||||
const sanitizedName = input.fileName.replace(/[^a-zA-Z0-9.-]/g, '_')
|
||||
const objectKey = `resources/${timestamp}-${sanitizedName}`
|
||||
|
||||
await ensureBucket(LEARNING_BUCKET)
|
||||
const url = await getPresignedUrl(LEARNING_BUCKET, objectKey, 'PUT', 3600)
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user